Exporting to Excel - force columns to text
Exporting to Excel - force columns to text
When exporting to Excel via the buttons feature, is there a way to specify the data type for each column? If Excel sees numbers in the column, it assumes the column is numeric when in fact I need it to be treated as text. I need to keep the padded zeroes on the front of each value. I found a sort of hack where I prepend a non-breaking space to the column data and that sort of works. Excel treats the data as text instead of numeric. Problem is, now when I export the Excel worksheet to XML, those fields/columns come out with an unrecognized character as the first character of each value.
Prior to DataTables, I built an XML file via code and opened that in Excel. I was able to specify the data type. With DataTables creating an XLSX file, how to I specify the column data type?
Answers
You might try setting
columns.type
for that column's config to 'string'.