Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Apr 18, 2023 3:20 pm

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

rakeshgovardhan
 
Posts: 1
Joined: Tue Apr 18, 2023 2:59 pm

Thu Apr 20, 2023 6:03 am

Hi,

Thank you for your inquiry.
Currently, our Spire.XLS does not support the feature to retrieve filtered records.
We would appreciate it if you could provide more details on the type of collection you are looking for so that we can better understand your needs, for example, rows’ indexes or CellRange objects? We will consider adding this feature in future updates.
Please let us know if you have any further questions or concerns.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.XLS