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

Free Support Forum - aspose.com

Exclude hidden row while converting excel data to data table

Hello Aspose Team,

I am using Aspose cell Licences version
I am using that for importing excel data in to data table
I am having that code and its working fine for me.
But there is one scenario, in that Excel file containing one hidden row, as a first row of that excel file.
And when its converting data into Data table its converting that hidden row as a header of that data table.
Which I don't want. This I am implenting in asp.net with C# language.

I want that at the time of reading excel file, it exclude the hidden row.

Kindly help me how I can do that.

Hi,


Well, if the first row is hidden, why don’t you start exporting data into DataTable with hidden row, you should start your data set to be exported (into DataTable) with visible row. For example, if the first row is hidden, you may skip it and starting your data matrix with 2nd row, see the sample line of code:
e.g
Sample code:

DataTable dt = worksheeet.Cells.ExportDataTable(1, 0, numRows, numCols, true);

Furthermore, you may evaluate if the first row is hidden or not at run time using Aspos.Cells API, so you may put correct value to the start row parameter, see the sample code segment below for your reference:
e.g
Sample code:

//Input value for your starting row index.
int sRow = 0;
if (worksheet.Cells.GetRow(sRow).IsHidden)
{
sRow = sRow +1;
}

DataTable dt = worksheeet.Cells.ExportDataTable(sRow, sCol, numRows, numCols, true);

Hope, this helps a bit.

Thank you.