We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Input string was not in a correct format.Couldn't store Expected type is Double

While am trying to convert cells to exportDataTable am getting exception as

Input string was not in a correct format.Couldn't store in Column3 Column. Expected type is Double.

am trying to export all the cell values into a datatable

below url am trying to export into datatable



Is there any method to convert excel to an .CSV format

Thanks in advance

This message was posted using Aspose.Live 2 Forum


Well, there is some missing or invalid values for some
columns you are exporting. If you look your data in the sheet, actually
there are two tables e.g A18:C21 and other table is: A24:C_; For your
information, the data type for ExportDataTable method is determined by
the first value of the column, suppose for your third column “HK Stock
Code” , its data type is double based on the first value, but there is
no value given for C22 and C23 respectedly, so the exception will be
For your need, you should do:

1) Export two data tables e.g A18:C21 and A24:C_ etc. separately.

You may use ExportDataTableAsString method instead of ExportDataTable
method, using the ExportDataTableAsString method would export all the
data in string types, so you may change the line:

var dt = ws.Cells.ExportDataTable(19, 0, 60, 3);


var dt = ws.Cells.ExportDataTableAsString(19, 0, 60, 3);

To export the excel file as .CSV, you may simply Save the workbook to your desired format, e.g

wb.Save(“C:\book1.csv”, SaveFormat.CSV)

see the document for your complete reference:

Thank you