0

How would I go about getting the row number from an ExcelWorksheet object based upon matching criteria? For example, need something like this:

int row = from w in WorkSheet
          where w.(rowValue) == matchingValue &&
                w.(secondRowValue) == secondMatchingValue
          select w.rowNumber

Is this possible using EPPlus?

NealR
  • 10,189
  • 61
  • 159
  • 299

1 Answers1

0

What I would do is load the sheet into a datatable using EPPlus like this: https://stackoverflow.com/a/13396787/1316683

Include the row number as the first column inside that loop, and then query the datatable:

DataRow[] matchingRow = myDataTable.Select(string.Format("rowValue = '{0}' AND secondRowValue = '{1}'", matchingValue, secondMatchingValue));
int row = matchingRow[0][0];
Community
  • 1
  • 1
MDave
  • 1,245
  • 13
  • 29