Hi,
I have requirement to filter 36000 rows of excel data based on the Id and loop through the filtered records only. I have applied the filters like this.
AutoFiltersCollection filters = worksheet.AutoFilters;
filters.Range = worksheet.Range[worksheet.FirstRow, worksheet.FirstColumn];
filters.AddFilter(0, "12345");
filters.Filter();
workbook.SaveToFile($"C:\\FilteredExcel.xlsx", ExcelVersion.Version2016);
for (int row = 1; row < worksheet.Rows.Length; row++)
{
if (worksheet.IsRowVisible(row + 1) == true)
{
//
}
}
But this loops 36000 times to get the filtered records based on the ID, which is time consuming and becoming a performace issue.
Is there a way to resolve this without impacting the performance or just get the filtered records so that I can loop into only filtered records.
Thanks,
Rakesh