Free Support Forum -

When Converting CSV File to XLSX- DateTime is converted to Number

When I load a CSV file into Apose and then save it as an xlsx file, the date fields show up as numbers when viewed in Excel.


Please provide us your xlsx file. We will investigate the problem.

Please also try the latest version:
for .NET v6.0.1.4

Hi, I’ve attached both files for you to view. I’ve also tried it with and got the same results.


Please use the code below to set the column number 1 to display date correctly. I have attached the output file and screenshot.


string path = @“F:\Shak-Data-RW\Downloads\test.csv”;

Workbook workbook = new Workbook(path);

Worksheet worksheet = workbook.Worksheets[0];

Style style = workbook.CreateStyle();

style.Custom = “dd-MM-yyyy”;

StyleFlag flag = new StyleFlag();

flag.All = true;

worksheet.Cells.Columns[1].ApplyStyle(style, flag);


workbook.Save(path + “.out.xlsx”);



The problem is that I will not know ahead of time which columns would require a date-time format. I may open a CSV that may have three or four columns with date-time in various positions. Is there a way to get it to automatically format those columns to a date-time format? Or at least a way to know that that column has date-time values in it so that I can manually set the format?


We have fixed this issue. Please download: Aspose.Cells for .NET v6.0.1.6

Thank you!