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

Free Support Forum - aspose.com

How to get all content of a sheet into data table without hard coding values

Taken from here,


//Exporting the contents of 7 rows and 2 columns starting from 1st cell to DataTable
DataTable dataTable = worksheet.Cells.ExportDataTableAsString(0, 0, 7, 2, true);

I can guess column headers... but I don't know how many rows end client going to add to the sheet.

Isn't there any better/generic way of doing this ?

Also has this not got implemented yet.

https://forum.aspose.com/t/105195


Many Thanks

Hi,


Thanks for your query.

1) Well, you may try to change the line of code to:
DataTable dataTable = worksheet.Cells.ExportDataTableAsString(0, 0, worksheet.Cells.MaxDataRow + 1, worksheet.Cells.MaxDataColumn + 1, true);

2) You should devise your own method to check if a worksheet with specific name exists or not. You may try the workaround as mentioned here:
https://forum.aspose.com/t/105195

Thank you.