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

Method cell

gspread/worksheet.py:327–371  ·  view source on GitHub ↗

Returns an instance of a :class:`gspread.cell.Cell` located at `row` and `col` column. :param row: Row number. :type row: int :param col: Column number. :type col: int :param value_render_option: (optional) Determines how values should be

(
        self,
        row: int,
        col: int,
        value_render_option: ValueRenderOption = ValueRenderOption.formatted,
    )

Source from the content-addressed store, hash-verified

325 )
326
327 def cell(
328 self,
329 row: int,
330 col: int,
331 value_render_option: ValueRenderOption = ValueRenderOption.formatted,
332 ) -> Cell:
333 """Returns an instance of a :class:`gspread.cell.Cell` located at
334 `row` and `col` column.
335
336 :param row: Row number.
337 :type row: int
338 :param col: Column number.
339 :type col: int
340 :param value_render_option: (optional) Determines how values should be
341 rendered in the output. See
342 `ValueRenderOption`_ in the Sheets API.
343 :type value_render_option: :class:`~gspread.utils.ValueRenderOption`
344
345 .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
346
347 Example:
348
349 >>> worksheet.cell(1, 1)
350 <Cell R1C1 "I'm cell A1">
351
352 :rtype: :class:`gspread.cell.Cell`
353 """
354 try:
355 data = self.get(
356 rowcol_to_a1(row, col),
357 value_render_option=value_render_option,
358 return_type=GridRangeType.ValueRange,
359 )
360
361 # we force a return type to GridRangeType.ValueRange
362 # help typing tool to see it too :-)
363 if isinstance(data, ValueRange):
364 value = data.first()
365 else:
366 raise RuntimeError("returned data must be of type ValueRange")
367
368 except KeyError:
369 value = ""
370
371 return Cell(row, col, value)
372
373 @cast_to_a1_notation
374 def range(self, name: str = "") -> List[Cell]:

Callers 10

acellMethod · 0.95
test_equalityMethod · 0.80
test_a1_valueMethod · 0.80
test_cellMethod · 0.80
test_update_cellMethod · 0.80

Calls 4

getMethod · 0.95
rowcol_to_a1Function · 0.85
CellClass · 0.85
firstMethod · 0.80

Tested by 9

test_equalityMethod · 0.64
test_a1_valueMethod · 0.64
test_cellMethod · 0.64
test_update_cellMethod · 0.64