I've written a python script that creates a new Excel file from an existing one by copying some columns only. For this, I've used tablib library, but I'm facing an error with columns that have dates as values.
In the original file the format is like this 11/23/2007, but in the output file is like this 39409.
I'm saving the excel file like this:
with open('output-2.xls', 'wb') as f:
new_dataset.headers = headers
f.write(new_dataset.export('xls'))
When I print the new_dataset the column has datetime.datetime(11, 23, 2007, 0, 0) object as values
So, how can I preserve the dates format in the output file?
I've written a python script that creates a new Excel file from an existing one by copying some columns only. For this, I've used tablib library, but I'm facing an error with columns that have dates as values.
In the original file the format is like this 11/23/2007, but in the output file is like this 39409.
I'm saving the excel file like this:
When I print the new_dataset the column has
datetime.datetime(11, 23, 2007, 0, 0)
object as valuesSo, how can I preserve the dates format in the output file?