When a table has to become JSON
- A product list kept in a sheet is needed as seed data or as a mock API response
- Translators hand back strings in Excel and the app wants a language file
- Survey results exported as CSV should go straight into a JavaScript chart as an array
- Before writing an importer, you want to see what column names and values another system’s export really contains
Line breaks and quotes inside a cell
Under RFC 4180, a field that holds a line break, a double quote or a comma is wrapped in double quotes, and a quote inside it is written twice. One consequence is that lines of text and rows of data are not the same thing.
- 1The header is title,body, and the next row is "Hello","line one<line break>line two", with the break inside the quotes.
- 2The result’s body is the single string "line one\nline two": three lines of text, one record.
- 3"He said ""no""" reads as He said "no", which JSON writes as "He said \"no\"".
- 4A quote that opens and never closes stops the conversion, and the message names the line and column where it started.
Type conversion is decided cell by cell
With number and true/false conversion on, a value becomes a number only when it is a plain integer or decimal. Trying it out: 1.50 becomes 1.5, while 1e5, +5 and .5 stay strings; TRUE becomes true whatever its case; -0 comes out as 0. " 7" with a leading space stays a string, since RFC 4180 counts spaces as part of the field. An integer too large to hold exactly, such as 12345678901234567890, also stays a string.
The decision is per cell, not per column. A price column holding 1,50 in one row and 12 in the next gives "1,50" and 12, a string and a number side by side. Where trailing zeros matter, as in prices or version numbers like 1.10, leave conversion off and convert only the columns you need in your own code.
The first line picks the separator
The separator is chosen by counting commas, tabs, semicolons and vertical bars outside quotes on the first line and taking the most frequent. A first line of a,b;c;d is therefore read with semicolons even if every data row uses commas, and a first line of "a;b;c",d is read with commas because the semicolons are inside quotes.
Cells copied from Excel or Google Sheets arrive as tab-separated text, so a pasted block of names and scores is read as tab-separated with no setting to change. In a European semicolon file, a decimal comma such as 1,50 is not turned into a number; it stays text. Pipe-separated files (a|b), common in log exports, are detected the same way.
CSV files saved by Korean Excel
Excel on Korean Windows saves “CSV (Comma delimited)” in the CP949 code page, an extension of EUC-KR, not in UTF-8; “CSV UTF-8” is a separate choice in the Save as list. When you open a file with the text-file button, the tool first tries strict UTF-8, falls back to EUC-KR if that fails, and drops a UTF-8 byte order mark. If the decoded text contains the replacement character (�), a button offers to reopen it in another encoding.
Files must be 1 MB or less and have a text extension such as .csv or .txt. For a bigger export, copying just the rows you need from the sheet and pasting them is quicker, and pasted text has no encoding to get wrong because the browser has already decoded it.