Skip to content

Commit a7b04cf

Browse files
committed
Added all the doc strings.
1 parent ae395fd commit a7b04cf

1 file changed

Lines changed: 59 additions & 1 deletion

File tree

gspread/worksheet.py

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ def append_records(
624624
ignore_extra_headers: bool = False,
625625
default_blank: Any = "",
626626
) -> None:
627-
"""Appends rows to you data range.
627+
"""Appends records as rows to your data range.
628628
629629
:param rows: A list of dictionaries, where each dictionary represents a row to be appended.
630630
The keys of the dictionaries should correspond to the column headers of the spreadsheet.
@@ -660,6 +660,20 @@ def append_record(
660660
ignore_extra_headers: bool = False,
661661
default_blank: Any = "",
662662
) -> None:
663+
"""Appends a dict as a row to your data range.
664+
665+
:param row: A dict. The keys of the dict should
666+
correspond to the column headers of the spreadsheet.
667+
:type row: Dict[str, Any]
668+
:param ignore_extra_headers: If True, extra headers found in the data set will be ignored. Otherwise,
669+
a `GSpreadException` will be raised. Defaults to False.
670+
:type ignore_extra_headers: bool
671+
:param default_blank: The value to use for missing columns in the data. Defaults to an empty string.
672+
:type default_blank: Any
673+
674+
:raises GSpreadException: If extra headers are found in the data set and `ignore_extra_headers` is False.
675+
"""
676+
663677
self.append_records(
664678
[row],
665679
ignore_extra_headers=ignore_extra_headers,
@@ -673,6 +687,28 @@ def insert_records(
673687
default_blank: Any = "",
674688
insert_row: int = 2,
675689
) -> None:
690+
"""Insert records as rows to your data range at the stated row.
691+
692+
:param rows: A list of dictionaries, where
693+
each dictionary represents a row to be inserted.
694+
The keys of the dictionaries should correspond
695+
to the column headers of the spreadsheet.
696+
:type rows: List[Dict[str, Any]]
697+
:param ignore_extra_headers: If True, extra headers found
698+
in the data set will be ignored. Otherwise,
699+
a `GSpreadException` will be raised. Defaults to False.
700+
:type ignore_extra_headers: bool
701+
:param default_blank: The value to use for missing
702+
columns in the data. Defaults to an empty string.
703+
:type default_blank: Any
704+
:param insert_row: Row number(1-indexed) where the
705+
data would be inserted. Defaults to 2.
706+
:type insert_row: int
707+
708+
:raises GSpreadException: If extra headers are found
709+
in the data set and `ignore_extra_headers` is False.
710+
"""
711+
676712
cols = self.column_headers
677713
insert_rows = []
678714
for row in rows:
@@ -697,6 +733,28 @@ def insert_record(
697733
default_blank: Any = "",
698734
insert_row: int = 2,
699735
) -> None:
736+
"""Insert a dict as rows to your data range at the stated row.
737+
738+
:param row: A dict, where
739+
each dictionary represents a row to be inserted.
740+
The keys of the dictionaries should correspond
741+
to the column headers of the spreadsheet.
742+
:type rows: List[Dict[str, Any]]
743+
:param ignore_extra_headers: If True, extra headers found
744+
in the data set will be ignored. Otherwise,
745+
a `GSpreadException` will be raised. Defaults to False.
746+
:type ignore_extra_headers: bool
747+
:param default_blank: The value to use for missing
748+
columns in the data. Defaults to an empty string.
749+
:type default_blank: Any
750+
:param insert_row: Row number(1-indexed) where the
751+
data would be inserted. Defaults to 2.
752+
:type insert_row: int
753+
754+
:raises GSpreadException: If extra headers are found
755+
in the data set and `ignore_extra_headers` is False.
756+
"""
757+
700758
self.insert_records(
701759
[row],
702760
ignore_extra_headers=ignore_extra_headers,

0 commit comments

Comments
 (0)