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

Free Support Forum - aspose.com

Problem with ExportDataTable and dates


I'm evaluating aspose.cells and am not an expert by any means so hopefully I'm just missing something simple.

What I'm trying to accomplish is much like the export data example in the demos: the user selects an excel file, excel file loaded to server, create workbook object, export sheet to datagrid.

We were doing this using the microsoft Jet and lately the Ace driver, but both are buggy.

I get this error when trying to open first sheet:

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

at System.Data.DataColumn.set_Item(Int32 record, Object value)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRow.set_Item(Int32 columnIndex, Object value)
at Aspose.Cells.Cells.ExportDataTable(Int32 firstRow, Int32 firstColumn, Int32 rowNumber, Int32 columnNumber)
at .PreviewSheet(String sDocName, String sSheetName) in X.aspx.cs:line 581

Best Regards and thanks in advance,

Zachary French

Blackline Systems Inc.

Zachary.French at Blackline.com

tried adding:

wb.ConvertNumericData = false;

still threw exception

Here's my code: (Pose is my alias for Aspose)

Pose.Workbook wb = new Pose.Workbook();


wb.ConvertNumericData = false;

Pose.Worksheet ws = wb.Worksheets[sSheetName];//Worksheets[0];

if(ws != null)


DataTable dt = ws.Cells.ExportDataTable(0, 0, ws.Cells.MaxRow + 1, ws.Cells.MaxColumn + 1);

grid.DataSource = dt;



After checking the first worksheet, we find it is not a simple data table. Please use Cells.ExportDataTableAsString() method to export the first worksheet to DataTable.

If you use Cells.ExportDataTable method, we will check the cells value type of the first row to set the DataTable column data type. The cell C3 contains a number value and the cell C12 contains a string value, an exception will be thrown when we add the value of the C12 to DataTable and the third column type is Double.

I some how missed that method, thank you so much!!!