We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Ignoring top 2 rows while reading report data??

I have to read ALMOST all of the data contained on a pre-existing excel spreadsheet and then place this data onto a new worksheet however I need to avoid reading the top 2 rows and I don't know how.

I'm reading data by using the following:
dataTable = sheet.ExportDataTable(sheet.UsedRange, ExcelExportDataTableOptions.ColumnNames);

This is grabbing all rows however. Is there a way I can grab all rows except for rows 1 & 2?

Thanks.
-Ryan

1 Reply

MW Melba Winshia Syncfusion Team May 7, 2007 07:03 AM UTC

Hi Ryan,

You can use the following code snippet to avoid reading the top 2 rows:

[C#]

//Read data from spreadsheet
DataTable customersTable = sheet.ExportDataTable(3, 1, sheet.UsedRange.End.Row, sheet.UsedRange.End.Column, ExcelExportDataTableOptions.ColumnNames);

Here is the sample for your reference:

http://websamples.syncfusion.com/samples/XlsIO.Web/4.4.0.51/60449/main.htm

Kindly let me know if you have any other questions.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon