Iwark/spreadsheet

Finding rows/columns by checking with the value

Closed this issue · 2 comments

If we are given some value, Can we determine the position of the value in the spreadsheet ?

Expected:
If a value is 28, Can I get the position like row = 10, column = 5. Is there any way I can get this type of behaviour ?

Iwark commented

@neymarsabin
Hi, you may need to scan all the cells which value is 28.
It will be something like this:

func FindPos(val string) (int, int) {
  for row, cells := range sheet.Rows {
    for column, cell := range cells {
      if cell.Value == val {
        return row, column
      }
    }
  }
  return -1, -1
}

Huge thanks for your help. @Iwark