In the above excel starting row is row number 29. I would like to read rows till value I starting from a. Here basically I would like to find it out row number I. Logic is if next row has empty(After I it is empty.) so i would like to find it out end row number. This rows are dynamic. It may be 5 in some files and 10 in other files. So logic is until next row starting is empty we need to loop and find it out the last row which has value. Below code I have
foreach (var sheet in sheets) { int startRowPort = starRowForPorts.Where(x=>x.Key == sheet.Name.Value).Select(x => x.Value).FirstOrDefault(); string relationshipId = sheet.Id.Value; WorksheetPart worksheetPart = (WorksheetPart)spreadSheetDocument.WorkbookPart.GetPartById(relationshipId); Worksheet workSheet = worksheetPart.Worksheet; ServicePortDto servicePortDto = new(); //Here I have start rowIndex //I would like to have end rowindex } Can someone please help me with any logic required here? Any help would be appreciated. Thanks
In the above excel starting row is row number 29. I would like to read rows till value I starting from a. Here basically I would like to find it out row number I. Logic is if next row has empty(After I it is empty.) so i would like to find it out end row number. This rows are dynamic. It may be 5 in some files and 10 in other files. So logic is until next row starting is empty we need to loop and find it out the last row which has value. Below code I have
foreach (var sheet in sheets) { int startRowPort = starRowForPorts.Where(x=>x.Key == sheet.Name.Value).Select(x => x.Value).FirstOrDefault(); string relationshipId = sheet.Id.Value; WorksheetPart worksheetPart = (WorksheetPart)spreadSheetDocument.WorkbookPart.GetPartById(relationshipId); Worksheet workSheet = worksheetPart.Worksheet; ServicePortDto servicePortDto = new(); //Here I have start rowIndex //I would like to have end rowindex } Can someone please help me with any logic required here? Any help would be appreciated. Thanks