Exporting error

Hi,

When I try to export data from the excel into a DataTable object, I get an error saying:

Input string was not in a correct format.Couldn’t store <45733-5883> in Column9 Column. Expected type is Double.

The code is pretty straight forward:
Dim dtInvestorData As DataTable = sheet1.Cells.ExportDataTable(7, 0, 6, sheet1.Cells.MaxDataColumn + 1, True)

Need help in finding what is going wrong…

thanks,
Sunil

PS: I am attaching a sample file…

Hi Sunil,

Thank you for considering Aspose.

Well, Cells.ExportDataTable is used when you have Strongly Typed Data in Sheet Columns. As your column contains both Numeric Values and String Values, you may use Cells.ExportDataTableAsString. It works fine as per your template file. For further details, please check the following documentation link:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/exporting-data-from-worksheets.html

Thank You & Best Regards

Hi,

Thank you for considering Aspose.

Also, you may use Cells.ExportDataTable(DataTable dataTable,int firstRow, int firstColumn, int rowNumber, bool exportColumnName) method and set the data type of the columns by yourself by creating your own data table if it fits your need.

Thank You & Best Regards,