ExportDataTableAsString : Row Number or Column number cannot be zero

I am exporting a spread sheet to a Data Table using ExportDataTableAsString method and the spreadsheet has only one row which has column names and the other rows are empty.

worksheet.Cells.ExportDataTableAsString(0, 0, worksheet.Cells.MaxRow + 1, worksheet.Cells.MaxColumn + 1, true);

I get exception stating "Row Number or Column number cannot be zero". Can somebody explain how to overcome this.

ihave attached the spreadsheet I m trying to upload.

Hi,

Please use Cells.ExportDataTable method instead:

worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxRow + 1, worksheet.Cells.MaxColumn + 1, true);

The Cells.ExportDataTableAsString method does not support to export a datatable having no records in it.

Thank you.