Export column as string in CSV
Export column as string in CSV

Hi,
I want to export large numbers in CSV with string format and not as numbers.
I know the solution works with .txt extension but I want to keep the extension as .csv.
I was able to implement this .xlsx but customize function but in case of CSV, customize just returns row data and nothing else.
Has anyone ever exported a column as string in CSV?
This discussion has been closed.
Answers
Looks like CSV export of large numbers works in this example:
http://live.datatables.net/cuwazidu/1/edit
Maybe you can update the example or provide a test case so we can see what you are doing.
Kevin
No @kthorngren. In your mentioned example, the CSV shows the number with exponential power. What I am trying to achieve is to export the exact value as a string so that, the exponential formatting doesn't work.
Please look at this screenshot, that I exported from your example:

Please check this JS BIn link to see how I am doing it for Excel
http://live.datatables.net/cuwazidu/3/edit
Hi @anujeet ,
This thread should help, it's asking the same thing.
Cheers,
Colin
A CSV file is a flat text file without any formatting, etc. Its not really an Excel file, although your OS may default to opening it in Excel when clicked on. This is what it looks like when opening in a text editor:
Which is the expected output.
To properly open in Excel you will need to use Data > Get External Data > Import Text File option (may be different depending on Excel version). Walking through that process you can mark columns as text so the import as you want.
Kevin
Hi. Thanks, I was able to resolve the issue in CSV by below code:
But I am facing an issue with my Excel export. When I open the exported xlsx file in Microsoft Excel, I get the below error on opening:
Does anyone else faced this issue?
I see some threads regarding this, but none of those are working. I have used below code to customize cell format in xlsx: