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

Method col_values

gspread/worksheet.py:696–731  ·  view source on GitHub ↗

Returns a list of all values in column `col`. Empty cells in this list will be rendered as :const:`None`. :param int col: Column number (one-based). :param str value_render_option: (optional) Determines how values should be rendered in the output. See `ValueRend

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

Source from the content-addressed store, hash-verified

694 return []
695
696 def col_values(
697 self,
698 col: int,
699 value_render_option: ValueRenderOption = ValueRenderOption.formatted,
700 ) -> List[Optional[Union[int, float, str]]]:
701 """Returns a list of all values in column `col`.
702
703 Empty cells in this list will be rendered as :const:`None`.
704
705 :param int col: Column number (one-based).
706 :param str value_render_option: (optional) Determines how values should
707 be rendered in the output. See `ValueRenderOption`_ in
708 the Sheets API.
709 :type value_render_option: :class:`~gspread.utils.ValueRenderOption`
710
711 .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
712 """
713
714 start_label = rowcol_to_a1(1, col)
715 range_label = "{}:{}".format(start_label, start_label[:-1])
716
717 range_name = absolute_range_name(self.title, range_label)
718
719 data = self.client.values_get(
720 self.spreadsheet_id,
721 range_name,
722 params={
723 "valueRenderOption": value_render_option,
724 "majorDimension": Dimension.cols,
725 },
726 )
727
728 try:
729 return data["values"][0]
730 except KeyError:
731 return []
732
733 def update_acell(self, label: str, value: Union[int, float, str]) -> JSONResponse:
734 """Updates the value of a cell.

Callers 2

test_insert_colsMethod · 0.80
test_delete_colsMethod · 0.80

Calls 4

rowcol_to_a1Function · 0.85
absolute_range_nameFunction · 0.85
formatMethod · 0.80
values_getMethod · 0.45

Tested by 2

test_insert_colsMethod · 0.64
test_delete_colsMethod · 0.64