I am creating a list based on an xls file. But I want to stop this when in encounter the first empty row. I tried:
data = [[ws.cell_value(r, c) for c in range(ws.ncols)] for r in range(ws.nrows)]
Which create the list with all rows.
Then I tried:
data = [[ws.cell_value(r, c) for c in range(ws.ncols)] if not cell.ctype in (xlrd.XL_CELL_EMPTY, xlrd.XL_CELL_BLANK) for r in range(ws.nrows)]
To have the empty rows removed but this gives me an error of invalid syntax.
Any help is appreciated