Thanks for your query.
The reason is Cells.MaxRow returns the last row index which contains data or formatting but the index is zero based. Suppose there are 10 rows in your worksheet, so when you use Cells.MaxRow it will return “9” (being zero based). But, you need to provide number of rows parameter as “10”. To cope with it, you will do add 1 row to the max row value. You may change the line of code as following:
worksheet.Cells.ExportDataTableAsString(0,0,worksheet.Cells.MaxRow + 1, 10, true);
Hope, this helps a bit.