MCPcopy
hub / github.com/burnash/gspread / _list_cells

Method _list_cells

gspread/worksheet.py:2282–2309  ·  view source on GitHub ↗

Returns a list of ``Cell`` instances scoped by optional ``in_row``` or ``in_column`` values (both one-based).

(
        self,
        values: Sequence[Sequence[Union[str, int, float]]],
        in_row: Optional[int] = None,
        in_column: Optional[int] = None,
    )

Source from the content-addressed store, hash-verified

2280 return func(match, cells)
2281
2282 def _list_cells(
2283 self,
2284 values: Sequence[Sequence[Union[str, int, float]]],
2285 in_row: Optional[int] = None,
2286 in_column: Optional[int] = None,
2287 ) -> List[Cell]:
2288 """Returns a list of ``Cell`` instances scoped by optional
2289 ``in_row``` or ``in_column`` values (both one-based).
2290 """
2291 if in_row is not None and in_column is not None:
2292 raise TypeError("Either 'in_row' or 'in_column' should be specified.")
2293
2294 if in_column is not None:
2295 return [
2296 Cell(row=i + 1, col=in_column, value=str(row[in_column - 1]))
2297 for i, row in enumerate(values)
2298 ]
2299 elif in_row is not None:
2300 return [
2301 Cell(row=in_row, col=j + 1, value=str(value))
2302 for j, value in enumerate(values[in_row - 1])
2303 ]
2304 else:
2305 return [
2306 Cell(row=i + 1, col=j + 1, value=str(value))
2307 for i, row in enumerate(values)
2308 for j, value in enumerate(row)
2309 ]
2310
2311 def find(
2312 self,

Callers 1

_finderMethod · 0.95

Calls 1

CellClass · 0.85

Tested by

no test coverage detected