A first CSV import often looks like this:
const text = await file . text ( ) ; const rows = text . trim ( ) . split ( '\n' ) . map ( ( line ) => line . split ( ',' ) ) ;
Enter fullscreen mode
Exit fullscreen mode
It works on the Google Sheets export you used for testing. Then a support ticket arrives:
"The import says every row is invalid. It's the same spreadsheet we use every month."
You open their file:
ID ; Name ; Email ; Plan ; Seats ; MRR ; Country C - 3001 ; Jos οΏ½ Mart οΏ½ nez ; jose @ example . es ; Pro ; 6 ; 299 , 00 ; ES
Enter fullscreen mode
Exit fullscreen mode
That one line hides three everyday Excel problems outside the US β and your two-liner hits all of them:
Encoding isn't UTF-8 β accented letters become οΏ½ ( file.text() always decodes UTF-8).
Delimiter is ; β European Excel uses semicolon when comma is the decimal separator.
299,00 is a number β decimal comma, not "invalid".
Add two more traps that show up the same week: newlines inside quoted fields , and dates like 05/03/2025β¦