Data Table to Excel numerical format

datatable
excel
activities

#1

I am pulling ID numbers from an excel sheet to a data table, adding a column, then trying to move the data table back to an excel file. However, when this is done, the format of the ID numbers changes to scientific notation. Example: Numbers that begin with 0’s are having the 0’s removed, numbers that begin with larger numbers are being rounded, and all are having decimals added to them. Is there a way to properly return the ID numbers in a string format when writing the range?


#2

Hi David,

Make sure your DataTable object is reading in these ID numbers as strings and it should write them back as text. Also make sure Excel is not automatically formatting these after the automation has finished as these cells may be programmed in Excel to scientific format.

Let me know if this works :wink:

-Phil


#3

In excel you can make the cell format as text.