How to ensure the numbers in CSV are 1 and not 1.

Data is imported from an excel, wherein they are detected as numbers and imported as 1., 2. etc. This poses a problem while exporting the again as csv

For example:

ImportString["a,b,c\n1.,NULL,d", "CSV"] (* emulating a import from excel 

Gives the output as (which is written to the CSV file using Export["file.csv",Import["file.xls"]]):


whereas the expected output is:


Is there a way to elegantly control such outputs/ behaviour of the CSV writer?

  • $\begingroup$ ExportString[ ImportString[ StringReplace["a,b,c\n1.,NULL,d", ".," -> ","], "CSV"], "CSV"] $\endgroup$ – Bob Hanlon Feb 8 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.