Incorrect Handling of XLSX data

Incorrect Handling of XLSX data

Trying to import an XLSX schedule of bills into Zoho Books I ran across the problem of date formatting.

To replicate: Build a CSV file with bill dates in whatever format you like and import it  - this should work if you match the "dd/MM/yyy" etc. format drop down.

Save that same file as an XLSX and attempt to import it. The import will likely fail due to incorrect date formats. The reason this happens is Excel doesn't internally store dates as a string, rather as numeric value (number of days since 1/1/1970.)

The workaround is to explicitly set the date columns in your XLSX  as "Text" rather than "General" ( / "Date"). 

The problem with this approach is that if you wanted to do any date functions in your Excel sheet they will fail.

A much better solution would be to recognise that a file is an xlsx and allow the user to specify a format in the drop-down of "Excel Defined". The import the utility can then use the  raw "numeric" value stored in the spreadsheet, to correctly set the relevant fields date. Not only does this allow Excel date functions to be used, but it also removes the "Locale" challenges you encounter when relying on csv.