Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/merge master into release 6 0 0 #1381

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release History
===============

5.12.4.(2023-12-31)
-------------------

* Bump actions/setup-python from 4 to 5 by @dependabot in https://github.com/burnash/gspread/pull/1370
* Fixed default value of merge_type parameter in merge_cells function docstring. by @neolooong in https://github.com/burnash/gspread/pull/1373

5.12.3 (2023-12-15)
-------------------

Expand Down
9 changes: 9 additions & 0 deletions gspread/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ class Dimension(StrEnum):
cols = "COLUMNS"


class MergeType(StrEnum):
merge_all = "MERGE_ALL"
merge_columns = "MERGE_COLUMNS"
merge_rows = "MERGE_ROWS"


SILENCE_WARNINGS_ENV_KEY = "GSPREAD_SILENCE_WARNINGS"
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved


class ValueRenderOption(StrEnum):
formatted = "FORMATTED_VALUE"
unformatted = "UNFORMATTED_VALUE"
Expand Down
11 changes: 6 additions & 5 deletions gspread/worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
Dimension,
GridRangeType,
InsertDataOption,
MergeType,
PasteOrientation,
PasteType,
T,
Expand Down Expand Up @@ -2492,14 +2493,14 @@ def copy_to(
)

@cast_to_a1_notation
def merge_cells(self, name: str, merge_type: str = "MERGE_ALL") -> JSONResponse:
"""Merge cells. There are 3 merge types: ``MERGE_ALL``, ``MERGE_COLUMNS``,
and ``MERGE_ROWS``.
def merge_cells(self, name: str, merge_type: str = MergeType.merge_all):
"""Merge cells.

:param str name: Range name in A1 notation, e.g. 'A1:A5'.
:param str merge_type: (optional) one of ``MERGE_ALL``,
``MERGE_COLUMNS``, or ``MERGE_ROWS``. Defaults to ``MERGE_ROWS``.
:param merge_type: (optional) one of ``MergeType.merge_all``,
``MergeType.merge_columns``, or ``MergeType.merge_rows``. Defaults to ``MergeType.merge_all``.
See `MergeType`_ in the Sheets API reference.
:type merge_type: :namedtuple:`~gspread.utils.MergeType`

Alternatively, you may specify numeric boundaries. All values
index from 1 (one):
Expand Down
Loading