How can I search for values in only part of a worksheet?
// set range temporale (default = ultima elaborazione)
DateTime fromDate = new DateTime(2024, 2, 9);
DateTime toDate = new DateTime(2024, 2, 9);
// restringo la ricerca nella TDL master ad un subset con un range definito da parametri (che dovrò gestire nella view)
// https://stackoverflow.com/questions/2237440/c-sharp-linq-where-date-between-2-dates
var range = from cell in tdlworksheet.Cells["R:R"]
where cell.Text == fromDate.Date.ToString("dd/MM/yyyy")
select tdlworksheet.Cells["A:P"];
// ora per ogni progetto vado a controllare se in TDL ho interventi
// https://learn.microsoft.com/it-it/dotnet/csharp/linq/get-started/write-linq-queries
foreach (string p in progetti)
{
// quindi cerco x Ambito solo sul range (non funziona)...
var qry = from cell in range.First().Worksheet.Cells["E:E"]
where cell.Text.ToLower().Contains(p.ToLower())
select cell;
if (qry.Count() > 0)
{
// todo
}
}
The idea is to create a portion of a very large sheet (>50,000 rows) in order to restrict the project search to a smaller data set, but I don't know if this is the right approach. Maybe I should create an in-memory worksheet, fill it with only a limited set of rows, and then use LINQ on the in-memory worksheet.
I expect to search for a project on a small set of data, not on the entire sheet.
Any ideas?
Tnks