editsqlite runs in your tab · nothing uploads

CSV column types: why 07102 became 7102

guide · 1 dec 2026 · by Saurav Kumar Sharma

How does the CSV import wizard pick column types? The CSV to SQLite page answers in one paragraph. This is the long version: one file taken through the wizard, the guesses it made, the columns where the guess was wrong for the data, and what to change in the dropdowns before you press create.

The test file

A customer list of 120 rows and eight columns: id, name, town, zip, phone, qty, amount and account. The first data row reads:

1,"Tom H.",Newark,07102,07700900013,8,10.35,400012341000007919

It was parsed and typed by csvwiz.js, the wizard's own machinery, and written to a .sqlite file by sqlwrite.js, the export writer. Both ran under Node so every value could be captured, and each file was then opened in the official sqlite3 tool to see what had really been stored.

What the wizard guessed

The rule is short. The wizard reads the whole column, skips empty cells, and asks every remaining value the same question. If all of them are whole numbers the column is INTEGER. If all are numbers and at least one has a decimal point or an exponent, it is REAL. Anything else, even once, makes it TEXT. On this file:

Four of the eight guesses need a second look.

Numbers that are not numbers

A postcode is made of digits, but nobody adds postcodes up. Stored as an integer it becomes a quantity, and quantities have no leading zeros. With every guess accepted, row 1 was stored as:

1 | Tom H. | Newark | 7102 | 7700900013 | 8 | 10.35 | 400012341000007940

Three values changed on the way in.

The zip lost its zero. Sixty of the 120 rows have a zip that starts with 0 (Newark, Boston and Hartford). After the import, SELECT count(*) FROM customers WHERE zip LIKE '0%' returned 0. Newark's 07102 is now 7102.

The phone number lost its zero too. 07700900013 became 7700900013, which is no longer something you can dial.

The account number lost its last digits. 400012341000007919 came back as 400012341000007940, and sqlite3 showed the stored value as 4.00012341000008e+17. A browser holds numbers exactly only up to 9,007,199,254,740,991, which is sixteen digits. An eighteen-digit identifier does not fit, so the tail is rounded. Unlike the missing zero, you cannot work out what the lost digits were.

None of this touches your CSV. The editor reads the file once and never writes to it, so the way back is to import it again with different types.

One stray word

The qty column went the other way. It holds 117 quantities and three cells that say n/a, so the whole column was typed as text. Nothing is lost, but text compares character by character, and "8" comes after "100" because 8 comes after 1. In the console:

SELECT id FROM customers WHERE qty > 100

returned 118 of the 120 rows. Counting by hand, 34 rows have a quantity above 100.

Changing the dropdown to integer helps: the 117 real quantities are stored as integers, and the three n/a cells are kept as text because the wizard will not turn a word into a number. The same query then returned 37 rows. That is the correct 34 plus the three n/a rows, since SQLite sorts any text above any number. The official tool gave the same 37.

The cleanest fix is in the file. Blank cells become NULL and do not affect the guess. With the three n/a cells emptied, the wizard typed qty as integer by itself and the query returned 34.

Other values worth knowing

Each of these was put through the same survey as a single-value column:

The same file, with four dropdowns changed

Second import: zip, phone and account set to text, qty set to integer, the rest left as guessed. Row 1 was stored as:

1 | Tom H. | Newark | 07102 | 07700900013 | 8 | 10.35 | 400012341000007919

In sqlite3, PRAGMA integrity_check; returned ok, the count of zips starting with 0 was 60, and all 120 account numbers were stored as text with every digit in place.

The short version: if you would never add a column up, set it to text. That covers postcodes, phone numbers, account and card numbers, order references and anything else that is a label made of digits. Look at each "auto" label before you create the table, and if the wizard types a column in a way these rules do not explain, write to the address on the contact page with a few sample values.