
    Ki                       S r SSKrSSKrSSKJr  SSKJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJr  SSKJr  SSKJr  SSKJrJr  SS	KJr  SS
K J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<  \SL a  SSK=J>r>  \" S\?\\?\4   S.5      r@\" S\?\\\      S.5      rA\\?\4   rB\" SSS9rC " S S\D5      rE " S S5      rFg)zW
gspread.worksheet
~~~~~~~~~~~~~~~~~

This module contains common worksheets' models.

    NCounter)TYPE_CHECKINGAnyCallableDictIterableIteratorListLiteralMappingMutableMappingOptionalSequenceTupleType	TypedDictTypeVarUnion   )Cell)GSpreadException)
HTTPClient
ParamsType)WORKSHEET_DRIVE_URL)DateTimeOption	DimensionGridRangeTypeInsertDataOption	MergeTypePasteOrientation	PasteTypeTTableDirectionValidationConditionTypeValueInputOptionValueRenderOptiona1_range_to_grid_rangea1_to_rowcolabsolute_range_namecast_to_a1_notationcell_list_to_rectcombined_merge_valuesconvert_colors_to_hex_valueconvert_hex_to_colors_dict	fill_gaps
find_tablefinditemget_a1_from_absolute_rangeis_full_a1_notationnumericise_allrowcol_to_a1
to_recordsT)Spreadsheet
CellFormatrangeformat	BatchData)r;   valuesValueRangeType
ValueRange)boundc                       \ rS rSr% Sr0 r\\\4   \S'   \	S\
\   S\\\4   S\4S j5       r\S\4S j5       r\S\4S	 j5       rSS\\   S\\   4S jjrSrg
)r@   U   a  The class holds the returned values.

This class inherit the :const:`list` object type.
It behaves exactly like a list.

The values are stored in a matrix.

The property :meth:`gspread.worksheet.ValueRange.major_dimension`
holds the major dimension of the first list level.

The inner lists will contain the actual values.

Examples::

    >>> worksheet.get("A1:B2")
    [
        [
            "A1 value",
            "B1 values",
        ],
        [
            "A2 value",
            "B2 value",
        ]
    ]

    >>> worksheet.get("A1:B2").major_dimension
    ROW

.. note::

   This class should never be instantiated manually.
   It will be instantiated using the response from the sheet API.
_jsonclsjsonreturnc                 Z    UR                  S/ 5      nU " U5      nUS   US   S.Ul        U$ )Nr>   r;   majorDimension)r;   rI   )getrD   )rE   rF   r>   new_objs       dC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\gspread/worksheet.py	from_jsonValueRange.from_json{   s;    (B'f+']"#34

     c                      U R                   S   $ )zThe range of the valuesr;   rD   selfs    rL   r;   ValueRange.range   s     zz'""rO   c                      U R                   S   $ )zThe major dimension of this range

Can be one of:

* ``ROW``: the first list level holds rows of values
* ``COLUMNS``: the first list level holds columns of values
rI   rQ   rR   s    rL   major_dimensionValueRange.major_dimension   s     zz*++rO   Ndefaultc                 8     U S   S   $ ! [          a    Us $ f = f)z`Returns the value of a first cell in a range.

If the range is empty, return the default value.
r   )
IndexError)rS   rX   s     rL   firstValueRange.first   s)    
	71: 	N	s   
  N)__name__
__module____qualname____firstlineno____doc__rD   r   str__annotations__classmethodr   r?   r   r   rM   propertyr;   rV   r   r[   __static_attributes__r]   rO   rL   r@   r@   U   s    !F ')E>#s(#(tN+ 7383D    #s # # , , ,Xc] hsm  rO   c                   f   \ rS rSrSr  SSSS\\\4   S\\   S\\	   4S	 jjr
S
\4S jr\S
\4S j5       r\SS j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\\   4S j5       rS
\\   4S jrS\S\\   S
\4S jr\R@                  4S\S\S
\!4S jjr"\R@                  4S \S!\S\S
\!4S" jjr#\$SS$\S
\%\!   4S% jj5       r&SSSSS&S&S'\'RP                  4S(\\   S)\\)   S\\   S*\\*   S+\S,\S-\S.\'S
\+\,\%\%\      4   4S/ jjr-SSSSS&S&S'\'RP                  4S(\\   S)\\)   S\\   S*\\*   S+\S,\S-\S.\'S
\+\,\%\%\      4   4S0 jjr.S1SSS#/ S&S&4S2\S3\\%\      S\\   S4\S5\/\+\\4      S6\S7\S
\%\0\\+\\1\4   4      4S8 jjr2S
\%\!   4S9 jr3   SS \S)\\)   S\\   S*\\*   S
\%\   4
S: jjr4\R@                  4S!\S\S
\%\\+\\1\4         4S; jjr5S\S<\+\\1\4   S
\64S= jr7S \S!\S<\+\\1\4   S
\64S> jr8\9Rt                  4S?\%\!   S@\9S
\;\\4   4SA jjr<SSSSS&S&S&\'RX                  4S(\\   S)\\)   S\\   S*\\*   S+\S,\S-\S.\'S
\+\,\%\%\      4   4SB jjr=   SSC\/\   S)\\)   S\\   S*\\*   S
\%\,   4
SD jjr>       SSE\/\/\      S(\\   SF\S)\\)   S@\\9   SG\\   SH\\   SI\\*   S
\64SJ jjr?     SSK\/\\\4      SF\S@\\9   SG\\   SH\\   SI\\*   S
\64SL jjr@SM\%\A   S
\64SN jrBSC\+\%\   \4   SO\6S
\64SP jrC SSQ\\   SR\\   S
\64SS jjrDSST.SU\E\\FSV   4   SW\\   S
\64SX jjrGSY\S
\64SZ jrHS[\S
\64S\ jrIS
\64S] jrJS^\S
\64S_ jrKS`\Sa\Sb\)S
\64Sc jrLSd\Se\S
\64Sf jrMSg\Sh\S
\64Si jrNSQ\S
S4Sj jrOSR\S
S4Sk jrP\9Rt                  SSS&4SE\Q\+\\\14      S@\9Sl\\R   Sm\\   SG\S
\64Sn jjrS\9Rt                  SSS4SE\Q\Q\+\\\14         S@\9Sl\\R   Sm\\   SG\\   S
\64So jjrTS1\9Rt                  S&4SE\Q\+\\\14      S^\S@\9Sp\S
\64
Sq jjrUS1\9Rt                  S&4SE\Q\Q\+\\\14         S \S@\9Sp\S
\64
Sr jjrVS1\9Rt                  S&4SE\Q\Q\+\\\14         S!\S@\9Sp\S
\64
Ss jjrW\$/ / SS&S&4S$\St\Q\   Su\Q\   Sv\\   Sw\Sx\S
\64Sy jj5       rXSz\S
\64S{ jrY SSb\)S`\Sa\\   S
\64S| jjrZ SS`\Sa\\   S
\64S} jjr[ SS`\Sa\\   S
\64S~ jjr\S
\64S jr]SC\Q\   S
\64S jr^  SS\_\_\!/\4   \/\!   /\`\!   4   S\+\\aR                  4   S\S\\   S\\   S
\`\!   4S jjrc  SSE\Q\Q\+\\\14         S\\   S\\   S
\%\!   4S jjrd   SS\+\\aR                  4   S\\   S\\   S\S
\\!   4
S jjre   SS\+\\aR                  4   S\\   S\\   S\S
\%\!   4
S jjrf SSQ\\   SR\\   S
\64S jjrg\$SS$\\   S
\4S jj5       rhS
\64S jri\j   SS\	S\S\S\S\\   S\\   S\\   S
S 4S jj5       rk   SS\\   S\\   S\\   S
S 4S jjrlS\S
\64S jrm\$\nR                  4S$\S\S
\4S jj5       rp\$S$\S
\64S j5       rq\nR                  4S\%\0\FS   \+\\n4   4      S\nS
\4S jjrr  SS\\   S\\   S
\%\%\      4S jjrsS\S
\4S jrtS\;\\4   S
S4S jru\$S\S\S
S4S j5       rv\$S\S\S
S4S j5       rwS\;\\4   S
S4S jrxSC\/\   S
S4S jry\$S\S
S4S j5       rz\$S$\S(\S
\64S j5       r{S\S
\64S jr|S\S\Sb\)S
\64S jr}S\S\S
\64S jr~S\S\S
\64S jrS\S\Sb\)S
\64S jrS\S\S
\64S jrS\S\S
\64S jrS
\%\6   4S jrS
\%\6   4S jrS\S\Sb\)S
\64S jrS\S\S
\64S jrS\S\S
\64S jrS\S\Sb\)S
\64S jrS\S\S
\64S jrS\S\S
\64S jrS\S
\64S jrS
\64S jrS
\64S jrS\S
\64S jrS
\64S jrS
\64S jr\GR$                  \GR$                  4S\S\S\S\S
\64
S jjr\GR$                  4S\S\S\S
\64S jjr   SSW\S\SE\/\   S\\   S\S\S
\4S jjrS\GR2                  4S\S\S
\%\%\      4S jjrSrg)	Worksheet   zMThe class that represents a single sheet in a spreadsheet
(aka "worksheet").
Nspreadsheetr8   
propertiesspreadsheet_idclientc                     Ub  O[        S5      eUb  [        U[        5      (       d  [        S5      eX0l        X@l        X l        Xl        g )NzMissing spreadsheet_id parameter, it must be provided with a
                valid spreadsheet ID.
                Please allocate new Worksheet object using method like:
                spreadsheet.get_worksheet(0)
                zMissing HTTP Client, it must be provided with a
                valid instance of type gspread.http_client.HTTPClient .
                Please allocate new Worksheet object using method like:
                spreadsheet.get_worksheet(0)
                )RuntimeError
isinstancer   rn   ro   _properties_spreadsheet)rS   rl   rm   rn   ro   s        rL   __init__Worksheet.__init__   s^     !R  >FJ!?!?  -% (rO   rG   c                     SR                  U R                  R                  [        U R                  5      U R
                  5      $ )Nz<{} {} id:{}>)r<   	__class__r_   reprtitleidrR   s    rL   __repr__Worksheet.__repr__   s5    %%NN##GG
 	
rO   c                      U R                   S   $ )zWorksheet ID.sheetIdrs   rR   s    rL   r{   Worksheet.id   s     	**rO   c                     U R                   $ )zParent spreadsheet)rt   rR   s    rL   rl   Worksheet.spreadsheet   s        rO   c                      U R                   S   $ )zWorksheet title.rz   r   rR   s    rL   rz   Worksheet.title        ((rO   c                 @    [         U R                  U R                  4-  $ )zWorksheet URL.)r   rn   r{   rR   s    rL   urlWorksheet.url   s     #d&9&9477%CCCrO   c                      U R                   S   $ )zWorksheet index.indexr   rR   s    rL   r   Worksheet.index   r   rO   c                 :    U R                   R                  SS5      $ )zWorksheet hidden status.hiddenFrs   rJ   rR   s    rL   isSheetHiddenWorksheet.isSheetHidden   s     ##He44rO   c                 &    U R                   S   S   $ )zNumber of rows.gridPropertiesrowCountr   rR   s    rL   	row_countWorksheet.row_count   s      01*==rO   c                 &    U R                   S   S   $ )zNumber of columns.

.. warning::

   This value is fetched when opening the worksheet.
   This is not dynamically updated when adding columns, yet.
r   columnCountr   rR   s    rL   	col_countWorksheet.col_count   s      01-@@rO   c                     U R                   $ )zNumber of columns)r   rR   s    rL   column_countWorksheet.column_count  s     ~~rO   c                 @    U R                   S   R                  SS5      $ )zNumber of frozen rows.r   frozenRowCountr   r   rR   s    rL   frozen_row_countWorksheet.frozen_row_count  s$      01556FJJrO   c                 @    U R                   S   R                  SS5      $ )zNumber of frozen columns.r   frozenColumnCountr   r   rR   s    rL   frozen_col_countWorksheet.frozen_col_count  s$      01556I1MMrO   c                 @    U R                   S   R                  SS5      $ )zJWhether or not gridlines hidden. Boolean.
True if hidden. False if shown.
r   hideGridlinesFr   rR   s    rL   is_gridlines_hiddenWorksheet.is_gridlines_hidden  s#    
  0155ouMMrO   c                 "    U R                  5       $ )z+Tab color style. Hex with RGB color values.)get_tab_colorrR   s    rL   	tab_colorWorksheet.tab_color  s     !!##rO   c                 x    U R                   R                  S0 5      R                  SS5      nUc  g[        S0 UD6$ )z&Tab color style in hex format. String.tabColorStylergbColorNr]   )rs   rJ   r.   )rS   r   s     rL   r   Worksheet.get_tab_color  s>    $$(("=AA*dS	*7Y77rO   rg   default_valuec                    ^  T R                   R                  T R                  5      n[        U 4S jUS   5      nUR	                  X5      $ )zAreturn a property of this worksheet or default value if not foundc                 .   > U S   S   TR                   :H  $ )Nrm   r   )r{   xrS   s    rL   <lambda>/Worksheet._get_sheet_property.<locals>.<lambda>(  s    aoi0DGG;rO   sheets)ro   fetch_sheet_metadatarn   r2   rJ   )rS   rg   r   metasheets   `    rL   _get_sheet_propertyWorksheet._get_sheet_property$  sA    {{//0C0CD;T(^
 yy11rO   labelvalue_render_optionc                 8    U R                   " [        U5      SU06$ )aA  Returns an instance of a :class:`gspread.cell.Cell`.

:param label: Cell label in A1 notation
              Letter case is ignored.
:type label: str
:param value_render_option: (optional) Determines how values should be
                            rendered in the output. See
                            `ValueRenderOption`_ in the Sheets API.
:type value_render_option: :class:`~gspread.utils.ValueRenderOption`

.. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

Example:

>>> worksheet.acell('A1')
<Cell R1C1 "I'm cell A1">
r   )cellr)   )rS   r   r   s      rL   acellWorksheet.acell-  s%    , yy5!
8K
 	
rO   rowcolc                      U R                  [        X5      U[        R                  S9n[	        U[        5      (       a  UR                  5       nO[        S5      e[        XU5      $ ! [         a    Sn Nf = f)ax  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
                            rendered in the output. See
                            `ValueRenderOption`_ in the Sheets API.
:type value_render_option: :class:`~gspread.utils.ValueRenderOption`

.. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

Example:

>>> worksheet.cell(1, 1)
<Cell R1C1 "I'm cell A1">

:rtype: :class:`gspread.cell.Cell`
)r   return_typez(returned data must be of type ValueRange )	rJ   r6   r   r@   rr   r[   rq   KeyErrorr   )rS   r   r   r   datavalues         rL   r   Worksheet.cellG  sy    6	88S&$7)44  D $
++

"#MNN
 Ce$$  	E	s   AA' A' 'A65A6r   namec                    [        U R                  U5      nU R                  R                  U R                  U5      nSU;  a,  UR                  SS5      nSU;   a  UR                  S5      S   n[        U5      nUR                  S/ 5      nUR                  SS5      nUR                  S	S5      nUR                  S
U R                  5      nUR                  SU R                  5      n	Ub  X-  nU	b  X-  n	[        UUU	S9n
[        U
5       VVVVs/ s H/  u  p[        U5        H  u  p[        X-   S-   X-   S-   US9PM     M1     snnnn$ s  snnnnf )ag  Returns a list of :class:`gspread.cell.Cell` objects from a specified range.

:param name: A string with range value in A1 notation (e.g. 'A1:A5')
             or the named range to fetch.
:type name: str

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

:rtype: list

Example::

    >>> # Using A1 notation
    >>> worksheet.range('A1:B7')
    [<Cell R1C1 "42">, ...]

    >>> # Same with numeric boundaries
    >>> worksheet.range(1, 1, 7, 2)
    [<Cell R1C1 "42">, ...]

    >>> # Named ranges work as well
    >>> worksheet.range('NamedRange')
    [<Cell R1C1 "42">, ...]

    >>> # All values in a single API call
    >>> worksheet.range()
    [<Cell R1C1 'Hi mom'>, ...]

:r;   r   !r   r>   startRowIndexr   startColumnIndexendRowIndexendColumnIndexrowscolsr   r   r   )r*   rz   ro   
values_getrn   rJ   splitr(   r   r   r0   	enumerater   )rS   r   range_labelr   
grid_ranger>   
row_offsetcolumn_offsetlast_rowlast_columnrect_valuesir   jr   s                  rL   r;   Worksheet.rangeu  sN   J *$**d;{{%%d&9&9;Gd?88GR(Dd{zz#q)+D1
(B'^^OQ7
"'91=>>-@ nn%5t~~F"H"(K
 $K0
0%cN Q^a'Q->-B%P* Q0
 	
 
s   6E
FT
range_namerV   date_time_render_optioncombine_merged_cellsmaintain_size
pad_valuesr   c	                 .    U R                  UUUUUUUUS9$ )zAlias for :meth:`~gspread.worksheet.Worksheet.get`...

with ``return_type`` set to ``List[List[Any]]``
and ``pad_values`` set to ``True``
(legacy method)
r   rV   r   r   r   r   r   r   rJ   	rS   r   rV   r   r   r   r   r   r   s	            rL   
get_valuesWorksheet.get_values  s2    " xx!+ 3$;!5'!#  	
 		
rO   c	                 .    U R                  UUUUUUUUS9$ )z8Alias to :meth:`~gspread.worksheet.Worksheet.get_values`r   )r   r   s	            rL   get_all_valuesWorksheet.get_all_values  s2     !+ 3$;!5'!#  	
 		
rO   r   headexpected_headersdefault_blanknumericise_ignore%allow_underscores_in_numeric_literals
empty2zeroc           
        ^ U R                  USS9nU/ /:X  a  / $ XS-
     mXS n	S n
Uc  U
" T5      nU(       a  [        SU S35      eOZU
" U5      nU(       a  [        SU 35      e[        U4S	 jU 5       5      (       d#  [        S
[        U5      [        T5      -
   35      eUS/:X  a  OU	 Vs/ s H  n[	        UUUUU5      PM     n	n[        TU	5      $ s  snf )ab  Returns a list of dictionaries, all of them having the contents of
the spreadsheet with the head row as keys and each of these
dictionaries holding the contents of subsequent rows of cells as
values.

This method uses the function :func:`gspread.utils.to_records` to build the resulting
records. It mainly wraps around the function and handles the simplest use case
using a header row (default = 1) and the rest of the entire sheet.

.. note::

   For more particular use-cases, please get your dataset, your headers and
   then use the function :func:`gspread.utils.to_records` to build the records.

Cell values are numericised (strings that can be read as ints or floats
are converted), unless specified in numericise_ignore

:param int head: (optional) Determines which row to use as keys,
    starting from 1 following the numeration of the spreadsheet.
:param list expected_headers: (optional) List of expected headers, they must be unique.

    .. note::

        Returned dictionaries will contain all headers even if not included in this list.
:param value_render_option: (optional) Determines how values should
    be rendered in the output. See `ValueRenderOption`_ in
    the Sheets API.
:type value_render_option: :class:`~gspread.utils.ValueRenderOption`
:param Any default_blank: (optional) Determines which value to use for
    blank cells, defaults to empty string.
:param list numericise_ignore: (optional) List of ints of indices of
    the columns (starting at 1) to ignore numericising, special use
    of ['all'] to ignore numericising on all columns.
:param bool allow_underscores_in_numeric_literals: (optional) Allow
    underscores in numeric literals, as introduced in PEP 515
:param bool empty2zero: (optional) Determines whether empty cells are
    converted to zeros when numericised, defaults to False.


Examples::

    # Sheet data:
    #      A    B    C
    #
    # 1    A1   B2   C3
    # 2    A6   B7   C8
    # 3    A11  B12  C13

    # Read all rows from the sheet
    >>> worksheet.get_all_records()
    [
        {"A1": "A6", "B2": "B7", "C3": "C8"},
        {"A1": "A11", "B2": "B12", "C3": "C13"}
    ]
T)r   r   r   Nc                 \    [        U 5      nU Vs/ s H  o!U   S:  d  M  UPM     sn$ s  snf )Nr   r   )itemscountsitems      rL   	get_dupes,Worksheet.get_all_records.<locals>.get_dupes>  s,    U^F%+@VTd|a/?DV@@@s   ))z5the header row in the worksheet contains duplicates: z[To manually set the header row, use the `expected_headers` parameter of `get_all_records()`z2the given 'expected_headers' contains duplicates: c              3   ,   >#    U  H	  oT;   v   M     g 7fr^   r]   ).0headerkeyss     rL   	<genexpr>,Worksheet.get_all_records.<locals>.<genexpr>Q  s     E4D&~4Ds   z7the given 'expected_headers' contains unknown headers: all)rJ   r   r  setr5   r7   )rS   r   r   r   r   r   r   r   entire_sheetr>   r   
duplicatesr   r  s                @rL   get_all_recordsWorksheet.get_all_records  sG   B xx 3   
 B4 I1H%e$	A #"4J&KJ<77   ##34J&HU  E4DEEE&M+,s4y89; 
 ' "	 "C !9% "  	 $''	s   1Cc                 "    U R                  5       $ )z2Returns a list of all `Cell` of the current sheet.r;   rR   s    rL   get_all_cellsWorksheet.get_all_cellsg  s     zz|rO   c                      U R                  SR                  X5      UUU5      nU(       a  US   $ / $ ! [         a    / s $ f = f)a  Returns a list of all values in a `row`.

Empty cells in this list will be rendered as :const:`None`.

:param int row: Row number (one-based).

:param str major_dimension: (optional) The major dimension of the
    values. `Dimension.rows` ("ROWS") or `Dimension.cols` ("COLUMNS").
    Defaults to Dimension.rows
:type major_dimension: :class:`~gspread.utils.Dimension`

:param value_render_option: (optional) Determines how values should
    be rendered in the output. See `ValueRenderOption`_ in
    the Sheets API.

    Possible values are:

    ``ValueRenderOption.formatted``
        (default) Values will be calculated and formatted according
        to the cell's formatting. Formatting is based on the
        spreadsheet's locale, not the requesting user's locale.

    ``ValueRenderOption.unformatted``
        Values will be calculated, but not formatted in the reply.
        For example, if A1 is 1.23 and A2 is =A1 and formatted as
        currency, then A2 would return the number 1.23.

    ``ValueRenderOption.formula``
        Values will not be calculated. The reply will include
        the formulas. For example, if A1 is 1.23 and A2 is =A1 and
        formatted as currency, then A2 would return "=A1".

    .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

:type value_render_option: :class:`~gspread.utils.ValueRenderOption`

:param date_time_render_option: (optional) How dates, times, and
    durations should be represented in the output.

    Possible values are:

    ``DateTimeOption.serial_number``
        (default) Instructs date, time, datetime, and duration fields
        to be output as doubles in "serial number" format,
        as popularized by Lotus 1-2-3.

    ``DateTimeOption.formatted_string``
        Instructs date, time, datetime, and duration fields to be output
        as strings in their given number format
        (which depends on the spreadsheet locale).

    .. note::

        This is ignored if ``value_render_option`` is ``ValueRenderOption.formatted``.

    The default ``date_time_render_option`` is ``DateTimeOption.serial_number``.
:type date_time_render_option: :class:`~gspread.utils.DateTimeOption`
zA{}:{}r   )rJ   r<   r   )rS   r   rV   r   r   r   s         rL   
row_valuesWorksheet.row_valuesl  sR    B		88)#'	D #47** 	I	s   .3 3 AAc                    [        SU5      nSR                  X3SS 5      n[        U R                  U5      nU R                  R                  U R                  UU[        R                  S.S9n US   S   $ ! [         a    / s $ f = f)	a  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 `ValueRenderOption`_ in
    the Sheets API.
:type value_render_option: :class:`~gspread.utils.ValueRenderOption`

.. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
r   {}:{}N)valueRenderOptionrI   paramsr>   r   )
r6   r<   r*   rz   ro   r   rn   r   r   r   )rS   r   r   start_labelr   r   r   s          rL   
col_valuesWorksheet.col_values  s    $ #1c*nn[cr2BC([A
{{%%%8"+.. & 
	>!$$ 	I	s   .A6 6BBr   c                 8    U R                   " [        U5      SU06$ )zUpdates the value of a cell.

:param str label: Cell label in A1 notation.
:param value: New value.

Example::

    worksheet.update_acell('A1', '42')
r   )update_cellr)   )rS   r   r   s      rL   update_acellWorksheet.update_acell  s     ,u"5DeDDrO   c                     [        U R                  [        X5      5      nU R                  R	                  U R
                  US[        R                  0SU//0S9nU$ )zUpdates the value of a cell.

:param int row: Row number.
:param int col: Column number.
:param value: New value.

Example::

    worksheet.update_cell(1, 1, '42')
valueInputOptionr>   r  body)r*   rz   r6   ro   values_updatern   r&   user_entered)rS   r   r   r   r   r   s         rL   r  Worksheet.update_cell  s`     )\#5KL
{{((&(8(E(EFeWI&	 ) 
 rO   	cell_listvalue_input_optionc                 j   [        U5      n[        [        S U 5       5      [        S U 5       5      5      n[        [        S U 5       5      [        S U 5       5      5      n[	        U R
                  SR                  XE5      5      nU R                  R                  U R                  USU0SU0S9nU$ )	a9  Updates many cells at once.

:param list cell_list: List of :class:`gspread.cell.Cell` objects to update.
:param  value_input_option: (optional) How the input data should be
    interpreted. Possible values are:

    ``ValueInputOption.raw``
        (default) The values the user has entered will not be parsed and will be
        stored as-is.

    ``ValueInputOption.user_entered``
        The values will be parsed as if the user typed them into the
        UI. Numbers will stay as numbers, but strings may be converted
        to numbers, dates, etc. following the same rules that are
        applied when entering text into a cell via
        the Google Sheets UI.

    See `ValueInputOption`_ in the Sheets API.

:type value_input_option: :namedtuple:`~gspread.utils.ValueInputOption`

.. _ValueInputOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption

Example::

    # Select a range
    cell_list = worksheet.range('A1:C7')

    for cell in cell_list:
        cell.value = 'O_o'

    # Update in batch
    worksheet.update_cells(cell_list)
c              3   8   #    U  H  oR                   v   M     g 7fr^   r   r  cs     rL   r  )Worksheet.update_cells.<locals>.<genexpr>+  s     )y!y   c              3   8   #    U  H  oR                   v   M     g 7fr^   r   r.  s     rL   r  r0  +  s     .Hiuuir1  c              3   8   #    U  H  oR                   v   M     g 7fr^   r-  r.  s     rL   r  r0  -  s     8iuuir1  c              3   8   #    U  H  oR                   v   M     g 7fr^   r3  r.  s     rL   r  r0  -  s     =WYeeYr1  r  r#  r>   r$  )
r,   r6   minmaxr*   rz   r<   ro   r&  rn   )rS   r)  r*  values_rectstartendr   r   s           rL   update_cellsWorksheet.update_cells  s    N (	2)y))3.Hi.H+H
 38i88#=WY=W:WX(W^^E5OP
{{((&(:;K(	 ) 
 rO   c	           	      $  ^ ^ [        T R                  T5      n	UUUS.n
T R                  R                  T R                  XS9nUR                  S/ /5      nUSL a   [        U5      nUSL a  T R                  R                  T R                  5      n[        U 4S jUS   5      nUR                  S/ 5      n[        U4S jU 5       5      (       a#  [        U4S	 jU5      nUR                  S
0 5      nO<Tb  [        T5      n[        U5      nO"UR                  S0 5      R                  S
0 5      n[        UUUR                  SS5      UR                  SS5      S9nT=(       d    SmUSL aG  [        T5      (       a7  [        T5      n[        U5      nUS   US   -
  nUS   US   -
  n[        UUUS9nU[        R                   L a  XS'   [         R#                  U5      $ U[        R$                  L a  U$ ['        S5      e! [         a    / /n GNf = f)a"  Reads values of a single range or a cell of a sheet.

Returns a ValueRange (list of lists) containing all values from a specified range or cell

By default values are returned as strings. See ``value_render_option``
to change the default format.

:param str range_name: (optional) Cell range in the A1 notation or
    a named range. If not specified the method returns values from all non empty cells.

:param str major_dimension: (optional) The major dimension of the
    values. `Dimension.rows` ("ROWS") or `Dimension.cols` ("COLUMNS").
    Defaults to Dimension.rows
:type major_dimension: :class:`~gspread.utils.Dimension`

:param value_render_option: (optional) Determines how values should
    be rendered in the output. See `ValueRenderOption`_ in
    the Sheets API.

    Possible values are:

    ``ValueRenderOption.formatted``
        (default) Values will be calculated and formatted according
        to the cell's formatting. Formatting is based on the
        spreadsheet's locale, not the requesting user's locale.

    ``ValueRenderOption.unformatted``
        Values will be calculated, but not formatted in the reply.
        For example, if A1 is 1.23 and A2 is =A1 and formatted as
        currency, then A2 would return the number 1.23.

    ``ValueRenderOption.formula``
        Values will not be calculated. The reply will include
        the formulas. For example, if A1 is 1.23 and A2 is =A1 and
        formatted as currency, then A2 would return "=A1".

    .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

:type value_render_option: :class:`~gspread.utils.ValueRenderOption`

:param str date_time_render_option: (optional) How dates, times, and
    durations should be represented in the output.

    Possible values are:

    ``DateTimeOption.serial_number``
        (default) Instructs date, time, datetime, and duration fields
        to be output as doubles in "serial number" format,
        as popularized by Lotus 1-2-3.

    ``DateTimeOption.formatted_string``
        Instructs date, time, datetime, and duration fields to be output
        as strings in their given number format
        (which depends on the spreadsheet locale).

    .. note::

        This is ignored if ``value_render_option`` is ``ValueRenderOption.formatted``.

    The default ``date_time_render_option`` is ``DateTimeOption.serial_number``.
:type date_time_render_option: :class:`~gspread.utils.DateTimeOption`

:param bool combine_merged_cells: (optional) If True, then all cells that
    are part of a merged cell will have the same value as the top-left
    cell of the merged cell. Defaults to False.

    .. warning::

        Setting this to True will cause an additional API request to be
        made to retrieve the values of all merged cells.

:param bool maintain_size: (optional) If True, then the returned values
    will have the same size as the requested range_name. Defaults to False.

:param bool pad_values: (optional) If True, then empty cells will be
    filled with empty strings. Defaults to False.

    .. warning::

            The returned array will not be rectangular unless this is set to True. If this is a problem, see also `maintain_size`.

:param GridRangeType return_type: (optional) The type of object to return.
    Defaults to :class:`gspread.utils.GridRangeType.ValueRange`.
    The other option is `gspread.utils.GridRangeType.ListOfLists`.

:rtype: :class:`gspread.worksheet.ValueRange`

.. versionadded:: 3.3

Examples::

    # Return all values from the sheet
    worksheet.get()

    # Return value of 'A1' cell
    worksheet.get('A1')

    # Return values of 'A1:B2' range
    worksheet.get('A1:B2')

    # Return all values from columns "A" and "B"
    worksheet.get('A:B')

    # Return values of 'my_range' named range
    worksheet.get('my_range')

    # Return unformatted values (e.g. numbers as numbers)
    worksheet.get('A2:B4', value_render_option=ValueRenderOption.unformatted)

    # Return cell values without calculating formulas
    worksheet.get('A2:B4', value_render_option=ValueRenderOption.formula)
rI   r  dateTimeRenderOptionr  r>   Tc                 .   > U S   S   TR                   :H  $ )Nrm   rz   )rz   r   s    rL   r   Worksheet.get.<locals>.<lambda>  s    !L/'2djj@rO   r   namedRangesc              3   d   >#    U  H%  nUR                  S 5      (       d  M  TUS    :H  v   M'     g7f)r   Nr   )r  ss_namedRanger   s     rL   r   Worksheet.get.<locals>.<genexpr>  s2      %1M $$V, 4
mF33%1s   00c                    > U S   T:H  $ )Nr   r]   )r   r   s    rL   r   rA    s    ai:5rO   r;   basicFilterr   r   r   )worksheet_metadatar>   start_row_indexstart_col_indexr   r   r   r   z4return_type must be either ValueRange or ListOfLists)r*   rz   ro   r   rn   rJ   r0   r   r   r2   anyr3   r(   r-   r4   r   r@   rM   ListOfLists
ValueError)rS   r   rV   r   r   r   r   r   r   get_range_namer  responser>   spreadsheet_metaworksheet_metanamed_rangesss_named_ranger   a1a1_ranger   r   s   ``                    rL   rJ   Worksheet.get:  s;   x -TZZD .!4$;
 ;;)) * 
 h-"6*  4'#{{??@S@ST%@ *N ,//rBL %1  
 "*5|" ,//<
'/
;3B7
 ,//rBFFwPRS
*#1 * B */A1 E	F  %2
 D %8%D%D1*=H/9Jm,z//JJD./*=O2PPDvDt<F-222!'X''11-333MOPPm  s   G> >HHrangesc                    U Vs/ s H!  oU(       d  M  [        U R                  U5      PM#     nnUUUS.nU R                  R                  U R                  XS9nUS    Vs/ s H  n[
        R                  U5      PM     sn$ s  snf s  snf )a%	  Returns one or more ranges of values from the sheet.

:param list ranges: List of cell ranges in the A1 notation or named
    ranges.

:param str major_dimension: (optional) The major dimension of the
    values. `Dimension.rows` ("ROWS") or `Dimension.cols` ("COLUMNS").
    Defaults to Dimension.rows
:type major_dimension: :class:`~gspread.utils.Dimension`

:param value_render_option: (optional) Determines how values should
    be rendered in the output. See `ValueRenderOption`_ in
    the Sheets API.

    Possible values are:

    ``ValueRenderOption.formatted``
        (default) Values will be calculated and formatted according
        to the cell's formatting. Formatting is based on the
        spreadsheet's locale, not the requesting user's locale.

    ``ValueRenderOption.unformatted``
        Values will be calculated, but not formatted in the reply.
        For example, if A1 is 1.23 and A2 is =A1 and formatted as
        currency, then A2 would return the number 1.23.

    ``ValueRenderOption.formula``
        Values will not be calculated. The reply will include
        the formulas. For example, if A1 is 1.23 and A2 is =A1 and
        formatted as currency, then A2 would return "=A1".

    .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

:type value_render_option: :class:`~gspread.utils.ValueRenderOption`

:param str date_time_render_option: (optional) How dates, times, and
    durations should be represented in the output.

    Possible values are:

    ``DateTimeOption.serial_number``
        (default) Instructs date, time, datetime, and duration fields
        to be output as doubles in "serial number" format,
        as popularized by Lotus 1-2-3.

    ``DateTimeOption.formatted_string``
        Instructs date, time, datetime, and duration fields to be output
        as strings in their given number format
        (which depends on the spreadsheet locale).

    .. note::

        This is ignored if ``value_render_option`` is ``ValueRenderOption.formatted``.

    The default ``date_time_render_option`` is ``DateTimeOption.serial_number``.
:type date_time_render_option: :class:`~gspread.utils.DateTimeOption`

.. versionadded:: 3.3

Examples::

    # Read values from 'A1:B2' range and 'F12' cell
    worksheet.batch_get(['A1:B2', 'F12'])
r>  )rW  r  valueRanges)r*   rz   ro   values_batch_getrn   r@   rM   )	rS   rW  rV   r   r   rr  rO  r   s	            rL   	batch_getWorksheet.batch_get  s    N ?EJf4%djj!4fJ .!4$;
 ;;// 0 
 2:-1HI1HA
$$Q'1HII K Js   
BB Br>   rawinclude_values_in_responseresponse_value_render_option response_date_time_render_optionc	                    [        U[        [        45      (       a1  [        U[        5      (       a  [        R
                  " S[        SS9  Xp[        U R                  U5      n	U(       d%  USL a  [        R                  O[        R                  nUUUUS.n
U R                  R                  U R                  U	U
XS.S9nU$ )a(  Sets values in a cell range of the sheet.

:param list values: The data to be written in a matrix format.
:param str range_name: (optional) The A1 notation of the values
    to update.

:param bool raw: The values will not be parsed by Sheets API and will
    be stored as-is. For example, formulas will be rendered as plain
    strings. Defaults to ``True``. This is a shortcut for
    the ``value_input_option`` parameter.

:param str major_dimension: (optional) The major dimension of the
    values. `Dimension.rows` ("ROWS") or `Dimension.cols` ("COLUMNS").
    Defaults to Dimension.rows
:type major_dimension: :class:`~gspread.utils.Dimension`

:param str value_input_option: (optional) How the input data should be
    interpreted. Possible values are:

    ``ValueInputOption.raw``
        (default) The values the user has entered will not be parsed and will be
        stored as-is.

    ``ValueInputOption.user_entered``
        The values will be parsed as if the user typed them into the
        UI. Numbers will stay as numbers, but strings may be converted
        to numbers, dates, etc. following the same rules that are
        applied when entering text into a cell via
        the Google Sheets UI.

:type value_input_option: :class:`~gspread.utils.ValueInputOption`

:param response_value_render_option: (optional) Determines how values should
    be rendered in the output. See `ValueRenderOption`_ in
    the Sheets API.

    Possible values are:

    ``ValueRenderOption.formatted``
        (default) Values will be calculated and formatted according
        to the cell's formatting. Formatting is based on the
        spreadsheet's locale, not the requesting user's locale.

    ``ValueRenderOption.unformatted``
        Values will be calculated, but not formatted in the reply.
        For example, if A1 is 1.23 and A2 is =A1 and formatted as
        currency, then A2 would return the number 1.23.

    ``ValueRenderOption.formula``
        Values will not be calculated. The reply will include
        the formulas. For example, if A1 is 1.23 and A2 is =A1 and
        formatted as currency, then A2 would return "=A1".

    .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

:type response_value_render_option: :class:`~gspread.utils.ValueRenderOption`

:param str response_date_time_render_option: (optional) How dates, times, and
    durations should be represented in the output.

    Possible values are:

    ``DateTimeOption.serial_number``
        (default) Instructs date, time, datetime, and duration fields
        to be output as doubles in "serial number" format,
        as popularized by Lotus 1-2-3.

    ``DateTimeOption.formatted_string``
        Instructs date, time, datetime, and duration fields to be output
        as strings in their given number format
        (which depends on the spreadsheet locale).

    .. note::

        This is ignored if ``value_render_option`` is ``ValueRenderOption.formatted``.

    The default ``date_time_render_option`` is ``DateTimeOption.serial_number``.
:type date_time_render_option: :class:`~gspread.utils.DateTimeOption`

Examples::

    # Sets 'Hello world' in 'A2' cell
    worksheet.update([['Hello world']], 'A2')

    # Updates cells A1, B1, C1 with values 42, 43, 44 respectively
    worksheet.update([[42, 43, 44]])

    # Updates A2 and A3 with values 42 and 43
    # Note that update range can be bigger than values array
    worksheet.update([[42], [43]], 'A2:B4')

    # Add a formula
    worksheet.update([['=SUM(A1:A4)']], 'A5', raw=False)

    # Update 'my_range' named range with values 42 and 43
    worksheet.update([[42], [43]], 'my_range')

    # Note: named ranges are defined in the scope of
    # a spreadsheet, so even if `my_range` does not belong to
    # this sheet it is still updated

.. versionadded:: 3.3
zThe order of arguments in worksheet.update() has changed. Please pass values first and range_name secondor used named arguments (range_name=, values=)   )
stacklevelT)r#  includeValuesInResponseresponseValueRenderOptionresponseDateTimeRenderOption)r>   rI   r$  )rr   listtuplerd   warningswarnDeprecationWarningr*   rz   r&   r^  r'  ro   r&  rn   )rS   r>   r   r^  rV   r*  r_  r`  ra  full_range_namer  rO  s               rL   updateWorksheet.updateT  s    d j4-00Z5L5LMMA # "(-djj*E!(+t $$9I9V9V 
 !3'A)E,L	
 ;;,,"F	 - 
 rO   r   c                     U(       d%  USL a  [         R                  O[         R                  nU H  n[        U R                  US   5      US'   M!     UUUUUS.nU R
                  R                  U R                  US9n	U	$ )aX  Sets values in one or more cell ranges of the sheet at once.

:param list data: List of dictionaries in the form of
    `{'range': '...', 'values': [[.., ..], ...]}` where `range`
    is a target range to update in A1 notation or a named range,
    and `values` is a list of lists containing new values.

:param str value_input_option: (optional) How the input data should be
    interpreted. Possible values are:

    * ``ValueInputOption.raw``

      The values the user has entered will not be parsed and will be
      stored as-is.

    * ``ValueInputOption.user_entered``

      The values will be parsed as if the user typed them into the
      UI. Numbers will stay as numbers, but strings may be converted
      to numbers, dates, etc. following the same rules that are
      applied when entering text into a cell via
      the Google Sheets UI.

:type value_input_option: :class:`~gspread.utils.ValueInputOption`

:param response_value_render_option: (optional) Determines how values should
    be rendered in the output. See `ValueRenderOption`_ in
    the Sheets API.

    Possible values are:

    ``ValueRenderOption.formatted``
        (default) Values will be calculated and formatted according
        to the cell's formatting. Formatting is based on the
        spreadsheet's locale, not the requesting user's locale.

    ``ValueRenderOption.unformatted``
        Values will be calculated, but not formatted in the reply.
        For example, if A1 is 1.23 and A2 is =A1 and formatted as
        currency, then A2 would return the number 1.23.

    ``ValueRenderOption.formula``
        Values will not be calculated. The reply will include
        the formulas. For example, if A1 is 1.23 and A2 is =A1 and
        formatted as currency, then A2 would return "=A1".

    .. _ValueRenderOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption

:type response_value_render_option: :class:`~gspread.utils.ValueRenderOption`

:param str response_date_time_render_option: (optional) How dates, times, and
    durations should be represented in the output.

    Possible values are:

    ``DateTimeOption.serial_number``
        (default) Instructs date, time, datetime, and duration fields
        to be output as doubles in "serial number" format,
        as popularized by Lotus 1-2-3.

    ``DateTimeOption.formatted_string``
        Instructs date, time, datetime, and duration fields to be output
        as strings in their given number format
        (which depends on the spreadsheet locale).

    .. note::

        This is ignored if ``value_render_option`` is ``ValueRenderOption.formatted``.

    The default ``date_time_render_option`` is ``DateTimeOption.serial_number``.
:type date_time_render_option: :class:`~gspread.utils.DateTimeOption`

Examples::

    worksheet.batch_update([{
        'range': 'A1:B1',
        'values': [['42', '43']],
    }, {
        'range': 'my_range',
        'values': [['44', '45']],
    }])

    # Note: named ranges are defined in the scope of
    # a spreadsheet, so even if `my_range` does not belong to
    # this sheet it is still updated

.. versionadded:: 3.3
Tr;   )r#  re  rf  rg  r   r%  )r&   r^  r'  r*   rz   ro   values_batch_updatern   )
rS   r   r^  r*  r_  r`  ra  r>   r%  rO  s
             rL   batch_updateWorksheet.batch_update  s    B "(+t $$9I9V9V  F1$**fWoNF7O  !3'A)E,L*
 ;;2243F3FT2RrO   formatsc                 "   S/ 0nU H`  nUS   nUS   n[        X@R                  5      nSSR                  UR                  5       5      -  nUS   R	                  SUSU0US.05        Mb     U R
                  R                  U R                  U5      $ )	a  Formats cells in batch.

:param list formats: List of ranges to format and the new format to apply
    to each range.

    The list is composed of dict objects with the following keys/values:

    * range : A1 range notation
    * format : a valid dict object with the format to apply
      for that range see `CellFormat`_ in the Sheets API for available fields.

.. _CellFormat: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#cellformat

Examples::

    # Format the range ``A1:C1`` with bold text
    # and format the range ``A2:C2`` a font size of 16

    formats = [
        {
            "range": "A1:C1",
            "format": {
                "textFormat": {
                    "bold": True,
                },
            },
        },
        {
            "range": "A2:C2",
            "format": {
                "textFormat": {
                    "fontSize": 16,
                },
            },
        },
    ]
    worksheet.batch_format(formats)

.. versionadded:: 5.4
requestsr;   r<   zuserEnteredFormat(%s),
repeatCelluserEnteredFormat)r;   r   fields)r(   r{   joinr  appendro   rs  rn   )rS   ru  r%  r<   r   cell_formatr   r{  s           rL   batch_formatWorksheet.batch_format\  s    X  
 FJ *K/
GGDJ,sxx8H8H8J/KKF## !+!4k B"(# $ {{''(;(;TBBrO   r<   c                     [        U[        5      (       a  UnOU/nU Vs/ s H  n[        XBS9PM     nnU R                  U5      $ s  snf )a  Format a list of ranges with the given format.

:param str|list ranges: Target ranges in the A1 notation.
:param dict format: Dictionary containing the fields to update.
    See `CellFormat`_ in the Sheets API for available fields.

Examples::

    # Set 'A4' cell's text format to bold
    worksheet.format("A4", {"textFormat": {"bold": True}})

    # Set 'A1:D4' and 'A10:D10' cells's text format to bold
    worksheet.format(["A1:D4", "A10:D10"], {"textFormat": {"bold": True}})

    # Color the background of 'A2:B2' cell range in black,
    # change horizontal alignment, text color and font size
    worksheet.format("A2:B2", {
        "backgroundColor": {
          "red": 0.0,
          "green": 0.0,
          "blue": 0.0
        },
        "horizontalAlignment": "CENTER",
        "textFormat": {
          "foregroundColor": {
            "red": 1.0,
            "green": 1.0,
            "blue": 1.0
          },
          "fontSize": 12,
          "bold": True
        }
    })

.. versionadded:: 3.3
r:   )rr   rh  r9   r  )rS   rW  r<   
range_listr;   ru  s         rL   r<   Worksheet.format  sN    P fd##J JGQRze:E9zR  )) Ss   Ar   r   c                 `   0 nUb  XS'   Ub  X#S'   U(       d  [        S5      eSR                  S UR                  5        5       5      nSSU R                  US.US	.0/0nU R                  R                  U R                  U5      nUb  XR                  S
   S'   Ub  X R                  S
   S'   U$ )zResizes the worksheet. Specify one of ``rows`` or ``cols``.

:param int rows: (optional) New number of rows.
:param int cols: (optional) New number columns.
r   r   ,Either 'rows' or 'cols' should be specified.rx  c              3   ,   #    U  H
  nS U-  v   M     g7fzgridProperties/%sNr]   r  ps     rL   r  #Worksheet.resize.<locals>.<genexpr>       R;Qa-1;Q   rw  updateSheetPropertiesr   r   rm   r{  r   	TypeErrorr|  r  r{   ro   rs  rn   rs   rS   r   r   grid_propertiesr{  r%  ress          rL   resizeWorksheet.resize  s     *.J'-1M*JKKR?;O;O;QRR +'+ww.=' #).

 kk&&t':':DA=A-.z:@D-.}=
rO   r  specs)ascdesr;   c                   U(       a.  UR                  S5      u  p4[        U5      u  pV[        U5      u  pxO<U R                  S   R                  SS5      S-   nSnU R                  nU R
                  nU R                  US-
  UUS-
  US.n	[        5       n
U H;  u  pUS:X  a  SnOUS	:X  a  S
nO[        S5      eUS-
  US.nU
R                  U5        M=     SSU	U
S.0/0nU R                  R                  U R                  U5      nU$ )aC  Sorts worksheet using given sort orders.

:param list specs: The sort order per column. Each sort order
    represented by a tuple where the first element is a column index
    and the second element is the order itself: 'asc' or 'des'.
:param str range: The range to sort in A1 notation. By default sorts
    the whole sheet excluding frozen rows.

Example::

    # Sort sheet A -> Z by column 'B'
    wks.sort((2, 'asc'))

    # Sort range A2:G8 basing on column 'G' A -> Z
    # and column 'B' Z -> A
    wks.sort((7, 'asc'), (2, 'des'), range='A2:G8')

.. versionadded:: 3.4
r   r   r   r   r   )r   r   r   r   r   r  	ASCENDINGr  
DESCENDINGz8Either 'asc' or 'des' should be specified as sort order.)dimensionIndex	sortOrderrw  	sortRange)r;   	sortSpecs)r   r)   rs   rJ   r   r   r{   rh  rM  r}  ro   rs  rn   )rS   r;   r  start_a1end_a1	start_row	start_colend_rowend_colrequest_rangerequest_sort_specsr   orderrequest_orderrequest_sort_specr%  rO  s                    rL   sortWorksheet.sort  s?   , ${{3/H#/#9 I+F3GW(()9:>>?OQRSVWWIInnGnnG ww&]" )A%
 "VJC~ +% , N  #&'*! %%&78    !.%7"	
 ;;++D,?,?FrO   rz   c                     SSU R                   US.SS.0/0nU R                  R                  U R                  U5      nXR                  S'   U$ )z7Renames the worksheet.

:param str title: A new title.
rw  r  )r   rz   rz   r  r{   ro   rs  rn   rs   )rS   rz   r%  rO  s       rL   update_titleWorksheet.update_title@  s`     +26''E&J").	
 ;;++D,?,?F$)!rO   colorc                     [        U5      nSSU R                  SU0S.SS.0/0nU R                  R                  U R                  U5      nSU0U R
                  S'   U$ )zsChanges the worksheet's tab color.
Use clear_tab_color() to remove the color.

:param str color:  Hex color value.
rw  r  r   r   r   r   r  )r/   r{   ro   rs  rn   rs   )rS   r  
color_dictr%  rO  s        rL   update_tab_colorWorksheet.update_tab_colorT  s     06
 +'+ww *J.' #2.

  ;;++D,?,?F-7,D)rO   c                     SSU R                   SS0S.SS.0/0nU R                  R                  U R                  U5      nU R                  R                  S5        U$ )zKClears the worksheet's tab color.
Use update_tab_color() to set the color.
rw  r  r   Nr  r   r  )r{   ro   rs  rn   rs   pop)rS   r%  rO  s      rL   clear_tab_colorWorksheet.clear_tab_colorr  sr    
 +'+ww *D.' #2.

 ;;++D,?,?F_-rO   r   c                     SSU R                   US.SS.0/0nU R                  R                  U R                  U5      nXR                  S'   U$ )a  Updates the ``index`` property for the worksheet.

See the `Sheets API documentation
<https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#sheetproperties>`_
for information on how updating the index property affects the order of worksheets
in a spreadsheet.

To reorder all worksheets in a spreadsheet, see `Spreadsheet.reorder_worksheets`.

.. versionadded:: 3.4
rw  r  )r   r   r   r  r  )rS   r   r%  r  s       rL   update_indexWorksheet.update_index  s`     +26''E&J").	
 kk&&t':':DA$)!
rO   start_index	end_index	dimensionc                 ~    SSSU R                   UUUS.00/0nU R                  R                  U R                  U5      $ )aV  Updates the size of rows or columns in the  worksheet.

Index start from 0

:param start_index: The index (inclusive) to begin resizing
:param end_index: The index (exclusive) to finish resizing
:param dimension: Specifies whether to resize the row or column
:type major_dimension: :class:`~gspread.utils.Dimension`


.. versionadded:: 5.3.3
rw  autoResizeDimensions
dimensionsr   r  
startIndexendIndexr{   ro   rs  rn   )rS   r  r  r  r%  s        rL   _auto_resizeWorksheet._auto_resize  sW      *$'+ww)2*5(1	'-	
 {{''(;(;TBBrO   start_column_indexend_column_indexc                 B    U R                  X[        R                  5      $ )a  Updates the size of rows or columns in the  worksheet.

Index start from 0

:param start_column_index: The index (inclusive) to begin resizing
:param end_column_index: The index (exclusive) to finish resizing


.. versionadded:: 3.4
.. versionchanged:: 5.3.3
)r  r   r   )rS   r  r  s      rL   columns_auto_resizeWorksheet.columns_auto_resize  s       !3y~~VVrO   rI  end_row_indexc                 B    U R                  X[        R                  5      $ )zUpdates the size of rows or columns in the  worksheet.

Index start from 0

:param start_row_index: The index (inclusive) to begin resizing
:param end_row_index: The index (exclusive) to finish resizing


.. versionadded:: 5.3.3
)r  r   r   )rS   rI  r  s      rL   rows_auto_resizeWorksheet.rows_auto_resize  s       PPrO   c                 <    U R                  U R                  U-   S9  g)zRAdds rows to worksheet.

:param rows: Number of new rows to add.
:type rows: int

)r   N)r  r   )rS   r   s     rL   add_rowsWorksheet.add_rows       	$./rO   c                 <    U R                  U R                  U-   S9  g)zXAdds columns to worksheet.

:param cols: Number of new columns to add.
:type cols: int

)r   N)r  r   )rS   r   s     rL   add_colsWorksheet.add_cols  r  rO   insert_data_optiontable_rangec                 *    U R                  U/UUUUS9$ )a  Adds a row to the worksheet and populates it with values.

Widens the worksheet if there are more values than columns.

:param list values: List of values for the new row.
:param value_input_option: (optional) Determines how the input data
    should be interpreted. See `ValueInputOption`_ in the Sheets API
    reference.
:type value_input_option: :class:`~gspread.utils.ValueInputOption`
:param str insert_data_option: (optional) Determines how the input data
    should be inserted. See `InsertDataOption`_ in the Sheets API
    reference.
:param str table_range: (optional) The A1 notation of a range to search
    for a logical table of data. Values are appended after the last row
    of the table. Examples: ``A1`` or ``B2:D4``
:param bool include_values_in_response: (optional) Determines if the
    update response should include the values of the cells that were
    appended. By default, responses do not include the updated values.

.. _ValueInputOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption
.. _InsertDataOption: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append#InsertDataOption

)r*  r  r  r_  )append_rows)rS   r>   r*  r  r  r_  s         rL   
append_rowWorksheet.append_row  s-    > H11#'A   
 	
rO   c                     [        U R                  U5      nUUUS.nSU0nU R                  R                  U R                  XgU5      n	[        U5      n
U R                  S   S==   U
-  ss'   U	$ )a  Adds multiple rows to the worksheet and populates them with values.

Widens the worksheet if there are more values than columns.

:param list values: List of rows each row is List of values for
    the new row.
:param value_input_option: (optional) Determines how input data
    should be interpreted. Possible values are ``ValueInputOption.raw``
    or ``ValueInputOption.user_entered``.
    See `ValueInputOption`_ in the Sheets API.
:type value_input_option: :class:`~gspread.utils.ValueInputOption`
:param str insert_data_option: (optional) Determines how the input data
    should be inserted. See `InsertDataOption`_ in the Sheets API
    reference.
:param str table_range: (optional) The A1 notation of a range to search
    for a logical table of data. Values are appended after the last row
    of the table. Examples: ``A1`` or ``B2:D4``
:param bool include_values_in_response: (optional) Determines if the
    update response should include the values of the cells that were
    appended. By default, responses do not include the updated values.

.. _ValueInputOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption
.. _InsertDataOption: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append#InsertDataOption
)r#  insertDataOptionre  r>   r   r   )r*   rz   ro   values_appendrn   lenrs   )rS   r>   r*  r  r  r_  r   r  r%  r  num_new_rowss              rL   r  Worksheet.append_rows  s|    @ *$**kB !3 2'A
 &!kk''(;(;[RVW6{)*:6,F6
rO   inherit_from_beforec                 (    U R                  U/UUUS9$ )a9  Adds a row to the worksheet at the specified index and populates it
with values.

Widens the worksheet if there are more values than columns.

:param list values: List of values for the new row.
:param int index: (optional) Offset for the newly inserted row.
:param str value_input_option: (optional) Determines how input data
    should be interpreted. Possible values are ``ValueInputOption.raw``
    or ``ValueInputOption.user_entered``.
    See `ValueInputOption`_ in the Sheets API.
:type value_input_option: :class:`~gspread.utils.ValueInputOption`
:param bool inherit_from_before: (optional) If True, the new row will
    inherit its properties from the previous row. Defaults to False,
    meaning that the new row acquires the properties of the row
    immediately after it.

    .. warning::

       `inherit_from_before` must be False when adding a row to the top
       of a spreadsheet (`index=1`), and must be True when adding to
       the bottom of the spreadsheet.

.. _ValueInputOption: https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption
)r*  r  )insert_rows)rS   r>   r   r*  r  s        rL   
insert_rowWorksheet.insert_rowK  s+    @ H1 3	   
 	
rO   c                 "   SU R                   ;   a  [        S5      eU(       a  US:X  a  [        S5      eSSU R                  [        R                  US-
  [        U5      U-   S-
  S.US.0/0nU R                  R                  U R                  U5        [        U R                   S	U-  5      nS
U0n[        R                  US.nU R                  R                  U R                  XgU5      n	[        U5      n
U R                  S   S==   U
-  ss'   U	$ )a  Adds multiple rows to the worksheet at the specified index and
populates them with values.

:param list values: List of row lists. a list of lists, with the lists
    each containing one row's values. Widens the worksheet if there are
    more values than columns.
:param int row: Start row to update (one-based). Defaults to 1 (one).
:param str value_input_option: (optional) Determines how input data
    should be interpreted. Possible values are ``ValueInputOption.raw``
    or ``ValueInputOption.user_entered``.
    See `ValueInputOption`_ in the Sheets API.
:type value_input_option: :class:`~gspread.utils.ValueInputOption`
:param bool inherit_from_before: (optional) If true, new rows will
    inherit their properties from the previous row. Defaults to False,
    meaning that new rows acquire the properties of the row immediately
    after them.

    .. warning::

       `inherit_from_before` must be False when adding rows to the top
       of a spreadsheet (`row=1`), and must be True when adding to
       the bottom of the spreadsheet.
r   ztcan't insert row in worksheet with colon ':' in its name. See issue: https://issuetracker.google.com/issues/36761154r   zTinherit_from_before cannot be used when inserting row(s) at the top of a spreadsheetrw  insertDimensionr  r;   inheritFromBeforezA%sr#  rI   r>   r   r   )rz   r   r{   r   r   r  ro   rs  rn   r*   r  rs   )rS   r>   r   r*  r  insert_dimension_bodyr   r  r%  r  r  s              rL   r  Worksheet.insert_rowsr  s"   B $**" G  3!8"f 
 %'+ww)2*-'(+Fc(9A(=	" .A(
!
  	  !4!46KL)$**eckB02DE"+..FCkk''(;(;[RVW6{)*:6,F6
rO   c                    U(       a  US:X  a  [        S5      eSSU R                  [        R                  US-
  [	        U5      U-   S-
  S.US.0/0nU R
                  R                  U R                  U5        [        U R                  [        SU5      5      nSU0n[        R                  US.nU R
                  R                  U R                  XgU5      n	[	        U5      n
U R                  S	   S
==   U
-  ss'   U	$ )a1  Adds multiple new cols to the worksheet at specified index and
populates them with values.

:param list values: List of col lists. a list of lists, with the lists
    each containing one col's values. Increases the number of rows
    if there are more values than columns.
:param int col: Start col to update (one-based). Defaults to 1 (one).
:param str value_input_option: (optional) Determines how input data
    should be interpreted. Possible values are ``ValueInputOption.raw``
    or ``ValueInputOption.user_entered``.
    See `ValueInputOption`_ in the Sheets API.
:type value_input_option: :class:`~gspread.utils.ValueInputOption`
:param bool inherit_from_before: (optional) If True, new columns will
    inherit their properties from the previous column. Defaults to
    False, meaning that new columns acquire the properties of the
    column immediately after them.

    .. warning::

       `inherit_from_before` must be False if adding at the left edge
       of a spreadsheet (`col=1`), and must be True if adding at the
       right edge of the spreadsheet.
r   z]inherit_from_before cannot be used when inserting column(s) at the left edge of a spreadsheetrw  r  r  r  r#  r  r   r   )r   r{   r   r   r  ro   rs  rn   r*   rz   r6   r  rs   )rS   r>   r   r*  r  r  r   r  r%  r  num_new_colss              rL   insert_colsWorksheet.insert_cols  s   > 3!8"o 
 %'+ww)2*-'(+Fc(9A(=	" .A(
!
  	  !4!46KL)$**l1c6JK02DE"+..FCkk''(;(;[RVW6{)*=9\I9
rO   editor_users_emailseditor_groups_emailsdescriptionwarning_onlyrequesting_user_can_editc           
          [        XR                  5      nSSSUUUUU(       a  SOUUS.S.00/0nU R                  R                  U R                  U5      $ )a]  Add protected range to the sheet. Only the editors can edit
the protected range.

Google API will automatically add the owner of this SpreadSheet.
The list ``editor_users_emails`` must at least contain the e-mail
address used to open that SpreadSheet.

``editor_users_emails`` must only contain e-mail addresses
who already have a write access to the spreadsheet.

:param str name: A string with range value in A1 notation,
    e.g. 'A1:A5'.

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

For both A1 and numeric notation:

:param list editor_users_emails: The email addresses of
    users with edit access to the protected range.
    This must include your e-mail address at least.
:param list editor_groups_emails: (optional) The email addresses of
    groups with edit access to the protected range.
:param str description: (optional) Description for the protected
    ranges.
:param boolean warning_only: (optional) When true this protected range
    will show a warning when editing. Defaults to ``False``.
:param boolean requesting_user_can_edit: (optional) True if the user
    who requested this protected range can edit the protected cells.
    Defaults to ``False``.
rw  addProtectedRangeprotectedRangeN)usersgroups)r;   r  warningOnlyrequestingUserCanEditeditorsr(   r{   ro   rs  rn   )	rS   r   r  r  r  r  r  r   r%  s	            rL   add_protected_rangeWorksheet.add_protected_range  s|    ^ ,D'':
 '(%/+6+75M $0 !% .A.B&"+*
. {{''(;(;TBBrO   r{   c                 `    SSSU00/0nU R                   R                  U R                  U5      $ )zDelete protected range identified by the ID ``id``.

To retrieve the ID of a protected range use the following method
to list them all: :func:`~gspread.Spreadsheet.list_protected_ranges`
rw  deleteProtectedRangeprotectedRangeIdro   rs  rn   )rS   r{   r%  s      rL   delete_protected_range Worksheet.delete_protected_rangeE  sD     **B-
 {{''(;(;TBBrO   c                 f   Uc  UnSSSU R                   UUS-
  US.00/0nU R                  R                  U R                  U5      nUc  UnX2-
  S-   nU[        R
                  :X  a  U R                  S   S==   U-  ss'   U$ U[        R                  :X  a  U R                  S   S==   U-  ss'   U$ )	a  Deletes multi rows from the worksheet at the specified index.

:param dimension: A dimension to delete. ``Dimension.rows`` or ``Dimension.cols``.
:type dimension: :class:`~gspread.utils.Dimension`
:param int start_index: Index of a first row for deletion.
:param int end_index: Index of a last row for deletion. When
    ``end_index`` is not specified this method only deletes a single
    row at ``start_index``.
rw  deleteDimensionr;   r   r  r   r   r   )r{   ro   rs  rn   r   r   rs   r   )rS   r  r  r  r%  r  num_deleteds          rL   delete_dimensionWorksheet.delete_dimensionX  s     #I %'+ww)2*5/(1	"(	
 kk&&t':':DA#I-1	&-.z:kI: 
 )..(-.}=L=
rO   c                 B    U R                  [        R                  X5      $ )a  Deletes multiple rows from the worksheet at the specified index.

:param int start_index: Index of a first row for deletion.
:param int end_index: Index of a last row for deletion.
    When end_index is not specified this method only deletes a single
    row at ``start_index``.

Example::

    # Delete rows 5 to 10 (inclusive)
    worksheet.delete_rows(5, 10)

    # Delete only the second row
    worksheet.delete_rows(2)

)r  r   r   rS   r  r  s      rL   delete_rowsWorksheet.delete_rows  s    & $$Y^^[LLrO   c                 B    U R                  [        R                  X5      $ )a#  Deletes multiple columns from the worksheet at the specified index.

:param int start_index: Index of a first column for deletion.
:param int end_index: Index of a last column for deletion.
    When end_index is not specified this method only deletes a single
    column at ``start_index``.
)r  r   r   r  s      rL   delete_columnsWorksheet.delete_columns  s     $$Y^^[LLrO   c                 t    U R                   R                  U R                  [        U R                  5      5      $ )z"Clears all cells in the worksheet.)ro   values_clearrn   r*   rz   rR   s    rL   clearWorksheet.clear  s.    {{''!4TZZ!@
 	
rO   c                     U Vs/ s H  n[        U R                  U5      PM     nnSU0nU R                  R                  U R                  US9nU$ s  snf )a  Clears multiple ranges of cells with 1 API call.

`Batch Clear`_

.. _Batch Clear: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchClear

Examples::

    worksheet.batch_clear(['A1:B1','my_range'])

    # Note: named ranges are defined in the scope of
    # a spreadsheet, so even if `my_range` does not belong to
    # this sheet it is still updated

.. versionadded:: 3.8.0

rW  rq  )r*   rz   ro   values_batch_clearrn   )rS   rW  rngr%  rO  s        rL   batch_clearWorksheet.batch_clear  sZ    $ CII&3%djj#6&I&!;;11$2E2ED1Q Js    Afuncquerycase_sensitivein_row	in_columnc                   ^^
^ U R                   R                  U R                  [        U R                  5      5      n [        US   5      nU R                  XtU5      n[        U[        5      (       a  UmS[        S[        4UU4S jjn	OA[        U[        R                  5      (       a  Um
S[        S[        4U
4S jjn	O[        S5      eU" X5      $ ! [         a    / n Nf = f)Nr>   r   rG   c                    > T(       d  U R                   c  U R                   T:H  $ U R                   R                  5       TR                  5       :H  $ r^   )r   casefold)r   r$  	str_querys    rL   match Worksheet._finder.<locals>.match  s>    !QWW_77i//77++-1C1C1EEErO   c                 >   > TR                  U R                  5      S L$ r^   )searchr   )r   re_querys    rL   r+  r,    s    qww/t;;rO   zIquery must be of type: 'str' or 're.Pattern' (obtained from re.compile()))ro   r   rn   r*   rz   r0   r   _list_cellsrr   rd   r   boolrePatternr  )rS   r"  r#  r$  r%  r&  r   r>   cellsr+  r/  r*  s      `      @@rL   _finderWorksheet._finder  s     {{%%!4TZZ!@
	tH~.F   ;eS!!IF F$ F F rzz**H< <$ < < [  E!!3  	F	s   C C#"C#c                    Ub  Ub  [        S5      eUb:  [        U5       VVs/ s H!  u  pE[        US-   U[        XSS-
     5      S9PM#     snn$ Ub9  [        XS-
     5       VVs/ s H  u  pg[        X&S-   [        U5      S9PM     snn$ [        U5       VVVVs/ s H4  u  pE[        U5        H  u  pg[        US-   US-   [        U5      S9PM!     M6     snnnn$ s  snnf s  snnf s  snnnnf )znReturns a list of ``Cell`` instances scoped by optional
``in_row``` or ``in_column`` values (both one-based).
z3Either 'in_row' or 'in_column' should be specified.r   r   )r  r   r   rd   )rS   r>   r%  r&  r   r   r   r   s           rL   r0  Worksheet._list_cells  s
    )"7QRR  (//FA QIS]9K5LM/   !*&!*< = =HA U#e*= =  (//FA )#HA QAEU< . =/ 

s   (C%"C";C(
c           	      d     [        U R                  [        XX#5      5      $ ! [         a     gf = f)a@  Finds the first cell matching the query.

:param query: A literal string to match or compiled regular expression.
:type query: str, :py:class:`re.RegexObject`
:param int in_row: (optional) One-based row number to scope the search.
:param int in_column: (optional) One-based column number to scope
    the search.
:param bool case_sensitive: (optional) comparison is case sensitive if
    set to True, case insensitive otherwise. Default is True.
    Does not apply to regular expressions.
:returns: the first matching cell or None otherwise
:rtype: :class:`gspread.cell.Cell`
N)nextr5  filterStopIteration)rS   r#  r%  r&  r$  s        rL   findWorksheet.find	  s1    (	VUFVWW 		s   " 
//c                 \    U R                  [        XX#5       Vs/ s H  nUPM     sn$ s  snf )aa  Finds all cells matching the query.

Returns a list of :class:`gspread.cell.Cell`.

:param query: A literal string to match or compiled regular expression.
:type query: str, :py:class:`re.RegexObject`
:param int in_row: (optional) One-based row number to scope the search.
:param int in_column: (optional) One-based column number to scope
    the search.
:param bool case_sensitive: (optional) comparison is case sensitive if
    set to True, case insensitive otherwise. Default is True.
    Does not apply to regular expressions.
:returns: the list of all matching cells or empty list otherwise
:rtype: list
)r5  r;  )rS   r#  r%  r&  r$  elems         rL   findallWorksheet.findall 	  s6    2 VUFV
V V
 	
 
s   )c                 `   0 nUb  XS'   Ub  X#S'   U(       d  [        S5      eSR                  S UR                  5        5       5      nSSU R                  US.US	.0/0nU R                  R                  U R                  U5      nUb  XR                  S
   S'   Ub  X R                  S
   S'   U$ )zFreeze rows and/or columns on the worksheet.

:param rows: Number of rows to freeze.
:param cols: Number of columns to freeze.
r   r   r  rx  c              3   ,   #    U  H
  nS U-  v   M     g7fr  r]   r  s     rL   r  #Worksheet.freeze.<locals>.<genexpr>O	  r  r  rw  r  r  r  r   r  r  s          rL   freezeWorksheet.freeze<	  s     04,-37/0JKKR?;O;O;QRR +'+ww.=' #).

 kk&&t':':DACG-./?@FJ-./BC
rO   c                     Ub  [        XR                  5      OSU R                  0nSSSSU000/0nU R                  R                  U R                  U5      $ )a  Add a basic filter to the worksheet. If a range or boundaries
are passed, the filter will be limited to the given range.

:param str name: A string with range value in A1 notation,
    e.g. ``A1:A5``.

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

.. versionadded:: 3.4
r   rw  setBasicFilterr;  r;   r  rS   r   r   r%  s       rL   set_basic_filterWorksheet.set_basic_filterf	  se    (  #41TWW% 	 .GZ;P0QRST{{''(;(;TBBrO   c                 t    SSSU R                   00/0nU R                  R                  U R                  U5      $ )zARemove the basic filter from a worksheet.

.. versionadded:: 3.4
rw  clearBasicFilterr   r  )rS   r%  s     rL   clear_basic_filterWorksheet.clear_basic_filter	  sH     &!477)
 {{''(;(;TBBrO   sheet_idinsert_sheet_indexnew_sheet_idnew_sheet_namec                 p    SSUUUUS.0/0nUR                  X(5      n	U	S   S   S   S   n
[        XJX!5      $ )a  Class method to duplicate a :class:`gspread.worksheet.Worksheet`.

:param Session client: The HTTP client used for the HTTP request
:param str spreadsheet_id: The spreadsheet ID (used for the HTTP request)
:param int sheet_id: The original sheet ID
:param int insert_sheet_index: (optional) The zero-based index
    where the new sheet should be inserted. The index of all sheets
    after this are incremented.
:param int new_sheet_id: (optional) The ID of the new sheet.
    If not set, an ID is chosen. If set, the ID must not conflict with
    any existing sheet ID. If set, it must be non-negative.
:param str new_sheet_name: (optional) The name of the new sheet.
    If empty, a new name is chosen for you.

:returns: a newly created :class:`gspread.worksheet.Worksheet`.

.. note::
   This is a class method in order for the spreadsheet class
   to use it without an instance of a Worksheet object
rw  duplicateSheet)sourceSheetIdinsertSheetIndex
newSheetIdnewSheetNamerepliesr   rm   )rs  rj   )rE   ro   rn   rQ  rl   rR  rS  rT  r%  r   rm   s              rL   
_duplicateWorksheet._duplicate	  se    B $)1,>&2(6	'	
 "">8)_Q'(89,G
.IIrO   c           
          [         R                  U R                  U R                  U R                  U R
                  UUUS9$ )a>  Duplicate the sheet.

:param int insert_sheet_index: (optional) The zero-based index
    where the new sheet should be inserted. The index of all sheets
    after this are incremented.
:param int new_sheet_id: (optional) The ID of the new sheet.
    If not set, an ID is chosen. If set, the ID must not conflict with
    any existing sheet ID. If set, it must be non-negative.
:param str new_sheet_name: (optional) The name of the new sheet.
    If empty, a new name is chosen for you.

:returns: a newly created :class:`gspread.worksheet.Worksheet`.

.. versionadded:: 3.1
)rR  rS  rT  )rj   r\  ro   rn   r{   rl   )rS   rR  rS  rT  s       rL   	duplicateWorksheet.duplicate	  sE    * ##KKGG1%) $ 
 	
rO   destination_spreadsheet_idc                 d    U R                   R                  U R                  U R                  U5      $ )zCopies this sheet to another spreadsheet.

:param str spreadsheet_id: The ID of the spreadsheet to copy
    the sheet to.
:returns: a dict with the response containing information about
    the newly created sheet.
:rtype: dict
)ro   spreadsheets_sheets_copy_torn   r{   )rS   ra  s     rL   copy_toWorksheet.copy_to	  s-     {{66*D
 	
rO   
merge_typec                     [        XR                  5      nSSX#S.0/0nU R                  R                  U R                  U5      $ )a  Merge cells.

:param str name: Range name in A1 notation, e.g. 'A1:A5'.
: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):

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

:returns: the response body from the request
:rtype: dict

.. _MergeType: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#MergeType

rw  
mergeCells)	mergeTyper;   r  )rS   r   rf  r   r%  s        rL   merge_cellsWorksheet.merge_cells	  sJ    0 ,D'':
 ,j(VWX
 {{''(;(;TBBrO   c                     [        XR                  5      nSSSU00/0nU R                  R                  U R                  U5      $ )a  Unmerge cells.

Unmerge previously merged cells.

:param str name: Range name in A1 notation, e.g. 'A1:A5'.

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

:returns: the response body from the request
:rtype: dict
rw  unmergeCellsr;   r  rJ  s       rL   unmerge_cellsWorksheet.unmerge_cells
  sT    ( ,D'':
 "%
 {{''(;(;TBBrO   mergesr;   ri  c           	          U Vs/ s H1  nS[        US   U R                  5      UR                  SU5      S.0PM3     nnU R                  R	                  U R
                  SU05      $ s  snf )a  Merge multiple ranges at the same time.

:param merges: list of dictionaries with the ranges(is A1-notation), and
    an optional ``MergeType`` field.
    See `MergeType`_ in the Sheets API reference.
:type merges: List[Dict[Literal["range", "mergeType"], Union[str, MergeType]]]
:params merge_type: (optional) default ``MergeType`` for all merges missing the merges.
    defaults to ``MergeType.merge_all``.
:type merge_type: ``MergeType``

example::

    worksheet.batch_merge(
        [
            {"range": "A1:M1"},
            {"range": "D2:H2", "mergeType": utils.MergeType.merge_rows}
        ]
    )

:returns: The body of the request response.
:rtype: dict
rh  r;   ri  rq  rw  )r(   r{   rJ   ro   rs  rn   )rS   rp  rf  mergerw  s        rL   batch_mergeWorksheet.batch_merge7
  s|    F  
   3E'NDGGL!&;
!C   	 
 {{''(;(;j(=STT
s   8A'default_empty_valuer   c                 t   S[        U R                  U5      S.nU R                  R                  U R                  U5      nUS   S   S   S   R                  S0 /5      n/ nU HQ  nUR                  / 5        UR                  S/ 5       H'  nUS   R                  UR                  S	U5      5        M)     MS     U$ )
aj  Returns a list of lists containing all notes in the sheet or range.

.. note::

    The resulting matrix is not necessarily square.
    The matrix is as tall as the last row with a note,
    and each row is only as long as the last column in that row with a note.


    Please see the example below.
    To ensure it is square, use `gspread.utils.fill_gaps`,
    for example like `utils.fill_gaps(arr, len(arr), max(len(a) for a in arr), None)`

:param str default_empty_value: (optional) Determines which value to use
    for cells without notes, defaults to None.
:param str grid_range: (optional) Range name in A1 notation, e.g. 'A1:A5'.

Examples::

    # Note data:
    #      A      B
    # 1    A1     -
    # 2    -      B2

    # Read all notes from the sheet
    >>> worksheet.get_notes()
    [
        ["A1"],
        ["", "B2"]
    ]
    >>> arr = worksheet.get_notes()
    >>> gspread.utils.fill_gaps(arr, len(arr), max(len(a) for a in arr), None)
    [
        ["A1", ""],
        ["", "B2"]
    ]
    # Read notes from a specific range
    >>> worksheet.get_notes(grid_range="A2:B2")
    [
        ["", "B2"]
    ]
zsheets.data.rowData.values.note)r{  rW  r   r   r   rowDatar>   r  note)r*   rz   ro   spreadsheets_getrn   rJ   r}  )	rS   rv  r   r  r  r   notesr   r   s	            rL   	get_notesWorksheet.get_notes_
  s    ` 8)$**jA

 kk**4+>+>G 8}Q'*..y2$?!#CLL"-b	  &2E!FG . 
 rO   r   c                     [        U R                  U5      nUSS.nU R                  R                  U R                  U5      n US   S   S   S   S   S   S   S   S   nU$ ! [
        [        4 a    S	n U$ f = f)
zGet the content of the note located at `cell`, or the empty string if the
cell does not have a note.

:param str cell: A string with cell coordinates in A1 notation,
    e.g. 'D7'.
zsheets/data/rowData/values/note)rW  r{  r   r   r   rx  r>   ry  r   )r*   rz   ro   rz  rn   rZ   r   )rS   r   absolute_cellr  r  ry  s         rL   get_noteWorksheet.get_note
  s     ,DJJ=#7
 kk**4+>+>G	x=#F+A.y9!<XFqI&QD  H% 	D	s   A" "A87A8r{  c                 R   S/ 0nUR                  5        Hi  u  p4[        U[        5      (       d  [        SR	                  X45      5      eS[        X0R                  5      SSSU0/0/S.0nUS   R                  U5        Mk     U R                  R                  U R                  U5        g)a  update multiple notes. The notes are attached to a certain cell.

:param notes dict: A dict of notes with their cells coordinates and respective content

    dict format is:

    * key: the cell coordinates as A1 range format
    * value: the string content of the cell

    Example::

        {
            "D7": "Please read my notes",
            "GH42": "this one is too far",
        }

.. versionadded:: 5.9
rw  z4Only string allowed as content for a note: '{} - {}'updateCellsry  r>   )r;   r{  r   N)r   rr   rd   r  r<   r(   r{   r}  ro   rs  rn   )rS   r{  r%  r;   contentreqs         rL   update_notesWorksheet.update_notes
  s    * 1;B/?#kkmNEgs++JQQ  3E77C$ %$*G!"' C  ##C(1 ,4 	  !4!4d;rO   r  c                 (    U R                  X05        g)zUpdate the content of the note located at `cell`.

:param str cell: A string with cell coordinates in A1 notation,
    e.g. 'D7'.
:param str note: The text note to insert.

.. versionadded:: 3.7
Nr  rS   r   r  s      rL   update_noteWorksheet.update_note
  s     	4/*rO   c                 (    U R                  X05        g)a  Insert a note. The note is attached to a certain cell.

:param str cell: A string with cell coordinates in A1 notation,
    e.g. 'D7'.
:param str content: The text note to insert.

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

.. versionadded:: 3.7
Nr  r  s      rL   insert_noteWorksheet.insert_note
  s    $ 	4/*rO   c                 &    U R                  U5        g)a  insert multiple notes. The notes are attached to a certain cell.

:param notes dict: A dict of notes with their cells coordinates and respective content

    dict format is:

    * key: the cell coordinates as A1 range format
    * value: the string content of the cell

    Example::

        {
            "D7": "Please read my notes",
            "GH42": "this one is too far",
        }

.. versionadded:: 5.9
Nr  )rS   r{  s     rL   insert_notesWorksheet.insert_notes  s    & 	% rO   c                 T    U Vs0 s H  o"S_M     nnU R                  U5        gs  snf )zClear all notes located at the at the coordinates
pointed to by ``ranges``.

:param ranges list: List of A1 coordinates where to clear the notes.
    e.g. ``["A1", "GH42", "D7"]``
r   Nr  )rS   rW  r;   r{  s       rL   clear_notesWorksheet.clear_notes  s-     )//u/%  0s   %c                 *    U R                  US05        g)a  Clear a note. The note is attached to a certain cell.

:param str cell: A string with cell coordinates in A1 notation,
    e.g. 'D7'.

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

.. versionadded:: 3.7
r   Nr  )rS   r   s     rL   
clear_noteWorksheet.clear_note&  s    $ 	4*%rO   c                     SSSU[        XR                  5      S.00/0nU R                  R                  U R                  U5      $ )a  
:param str name: A string with range value in A1 notation,
    e.g. 'A1:A5'.

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

:param int first_row: First row number
:param int first_col: First column number
:param int last_row: Last row number
:param int last_col: Last column number

:param range_name: The name to assign to the range of cells

:returns: the response body from the request
:rtype: dict
rw  addNamedRange
namedRange)r   r;   r  )rS   r   r   r%  s       rL   define_named_rangeWorksheet.define_named_range:  sV    ( #$$.%;D''%J'&	
 {{''(;(;TBBrO   named_range_idc                 `    SSSU00/0nU R                   R                  U R                  U5      $ )z
:param str named_range_id: The ID of the named range to delete.
    Can be obtained with Spreadsheet.list_named_ranges()

:returns: the response body from the request
:rtype: dict
rw  deleteNamedRangenamedRangeIdr
  )rS   r  r%  s      rL   delete_named_rangeWorksheet.delete_named_range[  sD     &&)
 {{''(;(;TBBrO   r9  r:  c                 ~    SSSU R                   UUUS.00/0nU R                  R                  U R                  U5      $ )a  
update this sheet by grouping 'dimension'

:param int start: The start (inclusive) of the group
:param int end: The end (exclusive) of the grou
:param str dimension: The dimension to group, can be one of
    ``ROWS`` or ``COLUMNS``.
:type diension: :class:`~gspread.utils.Dimension`
rw  addDimensionGroupr;   r  r  rS   r9  r:  r  r%  s        rL   _add_dimension_groupWorksheet._add_dimension_groupn  sW     ''+ww)2*/(+	"*	
 {{''(;(;TBBrO   c                 B    U R                  X[        R                  5      $ )a  
Group columns in order to hide them in the UI.

.. note::

    API behavior with nested groups and non-matching ``[start:end)``
    range can be found here: `Add Dimension Group Request`_

    .. _Add Dimension Group Request: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddDimensionGroupRequest

:param int start: The start (inclusive) of the group
:param int end: The end (exclusive) of the group
)r  r   r   rS   r9  r:  s      rL   add_dimension_group_columns%Worksheet.add_dimension_group_columns  s     ((Y^^DDrO   c                 B    U R                  X[        R                  5      $ )a   
Group rows in order to hide them in the UI.

.. note::

    API behavior with nested groups and non-matching ``[start:end)``
    range can be found here `Add Dimension Group Request`_

:param int start: The start (inclusive) of the group
:param int end: The end (exclusive) of the group
)r  r   r   r  s      rL   add_dimension_group_rows"Worksheet.add_dimension_group_rows  s     ((Y^^DDrO   c                 ~    SSSU R                   UUUS.00/0nU R                  R                  U R                  U5      $ )z&delete a dimension group in this sheetrw  deleteDimensionGroupr;   r  r  r  s        rL   _delete_dimension_group!Worksheet._delete_dimension_group  sW    
 *'+ww)2*/(+	"-	
 {{''(;(;TBBrO   c                 B    U R                  X[        R                  5      $ )a  
Remove the grouping of a set of columns.

.. note::

    API behavior with nested groups and non-matching ``[start:end)``
    range can be found here `Delete Dimension Group Request`_

    .. _Delete Dimension Group Request: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteDimensionGroupRequest

:param int start: The start (inclusive) of the group
:param int end: The end (exclusive) of the group
)r  r   r   r  s      rL   delete_dimension_group_columns(Worksheet.delete_dimension_group_columns  s     ++E	GGrO   c                 B    U R                  X[        R                  5      $ )a  
Remove the grouping of a set of rows.

.. note::
    API behavior with nested groups and non-matching ``[start:end)``
    range can be found here `Delete Dimension Group Request`_

:param int start: The start (inclusive) of the group
:param int end: The end (exclusive) of the group
)r  r   r   r  s      rL   delete_dimension_group_rows%Worksheet.delete_dimension_group_rows  s     ++E	GGrO   c                 &    U R                  S/ 5      $ )ze
List all the grouped columns in this worksheet.

:returns: list of the grouped columns
:rtype: list
columnGroupsr   rR   s    rL   list_dimension_group_columns&Worksheet.list_dimension_group_columns  s     '';;rO   c                 &    U R                  S/ 5      $ )z_
List all the grouped rows in this worksheet.

:returns: list of the grouped rows
:rtype: list
	rowGroupsr  rR   s    rL   list_dimension_group_rows#Worksheet.list_dimension_group_rows  s     ''R88rO   c                     SSU R                   UUUS.SS0SS.0/0nU R                  R                  U R                  U5      $ )aR  
Update this sheet by hiding the given 'dimension'

Index starts from 0.

:param int start: The (inclusive) start of the dimension to hide
:param int end: The (exclusive) end of the dimension to hide
:param str dimension: The dimension to hide, can be one of
    ``ROWS`` or ``COLUMNS``.
:type diension: :class:`~gspread.utils.Dimension`
rw  updateDimensionPropertiesr  hiddenByUserTr;   rm   r{  r  r  s        rL   _hide_dimensionWorksheet._hide_dimension  se     /'+ww)2*/(+	" +D' #12
& {{''(;(;TBBrO   c                 B    U R                  X[        R                  5      $ )z
Explicitly hide the given column index range.

Index starts from 0.

:param int start: The (inclusive) starting column to hide
:param int end: The (exclusive) end column to hide
)r  r   r   r  s      rL   hide_columnsWorksheet.hide_columns       ##E	??rO   c                 B    U R                  X[        R                  5      $ )z
Explicitly hide the given row index range.

Index starts from 0.

:param int start: The (inclusive) starting row to hide
:param int end: The (exclusive) end row to hide
)r  r   r   r  s      rL   	hide_rowsWorksheet.hide_rows  r  rO   c                     SSU R                   UUUS.SS0SS.0/0nU R                  R                  U R                  U5      $ )aY  
Update this sheet by unhiding the given 'dimension'

Index starts from 0.

:param int start: The (inclusive) start of the dimension to unhide
:param int end: The (inclusive) end of the dimension to unhide
:param str dimension: The dimension to hide, can be one of
    ``ROWS`` or ``COLUMNS``.
:type dimension: :class:`~gspread.utils.Dimension`
rw  r  r  r  Fr  r  r  s        rL   _unhide_dimensionWorksheet._unhide_dimension&  se     /'+ww)2*/(+	" +E' #12
& {{''(;(;TBBrO   c                 B    U R                  X[        R                  5      $ )z
Explicitly unhide the given column index range.

Index start from 0.

:param int start: The (inclusive) starting column to hide
:param int end: The (exclusive) end column to hide
)r  r   r   r  s      rL   unhide_columnsWorksheet.unhide_columnsI       %%e)..AArO   c                 B    U R                  X[        R                  5      $ )z
Explicitly unhide the given row index range.

Index start from 0.

:param int start: The (inclusive) starting row to hide
:param int end: The (exclusive) end row to hide
)r  r   r   r  s      rL   unhide_rowsWorksheet.unhide_rowsT  r  rO   r   c                     SSU R                   US.SS.0/0nU R                  R                  U R                  U5      nXR                  S'   U$ )z?Send the appropriate request to hide/show the current worksheetrw  r  )r   r   r   r  r  rS   r   r%  r  s       rL   _set_hidden_flagWorksheet._set_hidden_flag_  se     +'+ww&,' #+.

 kk&&t':':DA%+"
rO   c                 $    U R                  S5      $ )z(Hides the current worksheet from the UI.Tr  rR   s    rL   hideWorksheet.hidet  s    $$T**rO   c                 $    U R                  S5      $ )z%Show the current worksheet in the UI.Fr  rR   s    rL   showWorksheet.showx  s    $$U++rO   c                     SSU R                   SU0S.SS.0/0nU R                  R                  U R                  U5      nXR                  S   S'   U$ )z,Hide/show gridlines on the current worksheetrw  r  r   r  zgridProperties.hideGridlinesr  r   r  r  s       rL   _set_gridlines_hidden_flag$Worksheet._set_gridlines_hidden_flag|  ss     +'+ww //' #A.

  kk&&t':':DA>D)*?;
rO   c                 $    U R                  S5      $ )z'Hide gridlines on the current worksheetTr  rR   s    rL   hide_gridlinesWorksheet.hide_gridlines  s    ..t44rO   c                 $    U R                  S5      $ )z'Show gridlines on the current worksheetFr  rR   s    rL   show_gridlinesWorksheet.show_gridlines  s    ..u55rO   sourcedest
paste_typepaste_orientationc                     SS[        XR                  5      [        X R                  5      UUS.0/0nU R                  R                  U R                  U5      $ )a  Copies a range of data from source to dest

.. note::

   ``paste_type`` values are explained here: `Paste Types`_

   .. _Paste Types: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#pastetype

:param str source: The A1 notation of the source range to copy
:param str dest: The A1 notation of the destination where to paste the data
    Can be the A1 notation of the top left corner where the range must be paste
    ex: G16, or a complete range notation ex: G16:I20.
    The dimensions of the destination range is not checked and has no effect,
    if the destination range does not match the source range dimension, the entire
    source range is copies anyway.
:param paste_type: the paste type to apply. Many paste type are available from
    the Sheet API, see above note for detailed values for all values and their effects.
    Defaults to ``PasteType.normal``
:type paste_type: :class:`~gspread.utils.PasteType`
:param paste_orientation: The paste orient to apply.
    Possible values are: ``normal`` to keep the same orientation, ``transpose`` where all rows become columns and vice versa.
:type paste_orientation: :class:`~gspread.utils.PasteOrientation`
rw  	copyPaste)r  destination	pasteTypepasteOrientationr  )rS   r  r  r  r  r%  s         rL   
copy_rangeWorksheet.copy_range  s]    > "8"I'=dGG'L%/,=	"	
 {{''(;(;TBBrO   c                     [        X R                  5      nSS[        XR                  5      US   US   US   S.US.0/0nU R                  R                  U R                  U5      $ )a  Moves a range of data form source to dest

.. note::

   ``paste_type`` values are explained here: `Paste Types`_

   .. _Paste Types: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#pastetype

:param str source: The A1 notation of the source range to move
:param str dest: The A1 notation of the destination where to paste the data
    **it must be a single cell** in the A1 notation. ex: G16
:param paste_type: the paste type to apply. Many paste type are available from
    the Sheet API, see above note for detailed values for all values and their effects.
    Defaults to ``PasteType.normal``
:type paste_type: :class:`~gspread.utils.PasteType`
rw  cutPaster   r   r   )r   rowIndexcolumnIndex)r  r  r  r  )rS   r  r  r  	grid_destr%  s         rL   	cut_rangeWorksheet.cut_range  s~    4 +49	 "8"I'0';(1/(B+45G+H(
 &0!

  {{''(;(;TBBrO   condition_typeinputMessagestrictshowCustomUic           	         [        U[        5      (       d  [        S5      e[        XR                  5      nSSUUU Vs/ s H  nSU0PM	     snS.UUUS.S.0/0n	U R
                  R                  U R                  U	5      $ s  snf )aG  Adds a data validation rule to any given range.

.. note::

    ``condition_type`` values are explained here: `ConditionType`_

    .. _ConditionType: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ConditionType


:param str source: The A1 notation of the source range to move
:param condition_type: The sort of condition to apply.
:param values: List of condition values.
:type values: Any
:param str inputMessage: Message to show for the validation.
:param bool strict: Whether to reject invalid data or not.
:param bool showCustomUi: Whether to show a custom UI(Dropdown) for list values.

**Examples**

.. code-block:: python

    import gspread
    from gspread.utils import ValidationConditionType


    ...

    ws = spreadsheet.sheet1

    ws.add_validation(
        'A1',
        ValidationConditionType.number_greater,
        [10],
        strict=True,
        inputMessage='Value must be greater than 10',
    )

    ws.add_validation(
        'C2:C7',
        ValidationConditionType.one_of_list,
        ['Yes','No'],
        showCustomUi=True
    )
z?condition_type param should be a valid ValidationConditionType.rw  setDataValidationuserEnteredValue)typer>   )	conditionr  r  r  )r;   rule)rr   r%   r  r(   r{   ro   rs  rn   )
rS   r;   r  r>   r  r  r  gridr   r%  s
             rL   add_validationWorksheet.add_validation  s    l .*ABBQ  &eWW5 '!% )7OU+"OUe&8%%@v+"* -9&,,8
!*
* {{''(;(;TBB+"s   BA1top_left_range_name	directionc                 8    U R                  SS9n[        X1U5      $ )a  Expands a cell range based on non-null adjacent cells.

Expand can be done in 3 directions defined in :class:`~gspread.utils.TableDirection`

* ``TableDirection.right``: expands right until the first empty cell
* ``TableDirection.down``: expands down until the first empty cell
* ``TableDirection.table``: expands right until the first empty cell and down until the first empty cell

In case of empty result an empty list is restuned.

When the given ``start_range`` is outside the given matrix of values the exception
:class:`~gspread.exceptions.InvalidInputValue` is raised.

Example::

    values = [
        ['', '',   '',   '', ''  ],
        ['', 'B2', 'C2', '', 'E2'],
        ['', 'B3', 'C3', '', 'E3'],
        ['', ''  , ''  , '', 'E4'],
    ]
    >>> utils.find_table(TableDirection.table, 'B2')
    [
        ['B2', 'C2'],
        ['B3', 'C3'],
    ]


.. note::

    the ``TableDirection.table`` will look right from starting cell then look down from starting cell.
    It will not check cells located inside the table. This could lead to
    potential empty values located in the middle of the table.

.. note::

    when it is necessary to use non-default options for :meth:`~gspread.worksheet.Worksheet.get`,
    please get the data first using desired options then use the function
    :func:`gspread.utils.find_table` to extract the desired table.

:param str top_left_range_name: the top left corner of the table to expand.
:param gspread.utils.TableDirection direction: the expand direction
:rtype list(list): the resulting matrix
T)r   )rJ   r1   )rS   r  r  r>   s       rL   expandWorksheet.expandJ  s"    d T*&yAArO   )rs   rt   ro   rn   )NN)rG   r8   )r   )NNN)NTNNNNN)TNNNNr^   )NNT)r   N)NFF)r_   r`   ra   rb   rc   r   rd   r   r   r   ru   r|   rg   intr{   rl   rz   r   r   r1  r   r   r   r   r   r   r   r   r   r#   r   r'   	formattedr   r   r   r+   r   r;   r   rL  r   r   r   r@   r   r   r	   r   floatr  r  r  r  JSONResponser   r  r&   r^  r   r;  rJ   r\  rn  rs  r9   r  r<   r  r   r   r  r  r  r  r  r  r  r  r  r  r   r   r  r  r  r  r  r  r  r  r  r  r  r   r   r
   r2  r3  r5  r0  r=  rA  rF  rK  rO  rf   r\  r_  rd  r    	merge_allrj  rn  rt  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r"   normalr!   r  r  r%   r  r$   tabler  rh   r]   rO   rL   rj   rj      s    )-'+$("$( #38,$( !	$(
 $$(L
# 
 +C + + ! ! )s ) ) DS D D )s ) ) 5t 5 5
 >3 > > A3 A A c   K# K K N# N N NT N N $8C= $ $8x} 82C 2 2PQ 2 2C1L1L

 /
 
	
< 2C1L1L	,%,% ,% /	,%
 
,%\ F
# F
tDz F
 F
T %)/3;?<@%*#%2%>%>
SM
 "),
 &&78	

 "*.!9
 #
 
 
 #
 
z4S	?*	+
< %)/3;?<@%*#%2%>%>
SM
 "),
 &&78	

 "*.!9
 #
 
 
 #
 
z4S	?*	+
2 04;?796; t(t( #49-t( &&78	t(
 t( $E#s(O4t( 04t( t( 
d3c5#o../	0t(ltDz  04;?<@JJ "),J &&78	J
 "*.!9J 
cJ^ 2C1L1L## /# 
huS%_-.	/	#J
E# 
EeCO.D 
E 
E ).sE3)?	6 0@/C/C7:7 -7 
c		7v %)/3;?<@%*# %2%=%=CQSMCQ "),CQ &&78	CQ
 "*.!9CQ #CQ CQ CQ #CQ 
z4S	?*	+CQP 04;?<@SJSJ "),SJ &&78	SJ
 "*.!9SJ 
j	SJp %)/39=59DHEIQ#'Q SMQ 	Q
 "),Q %%56Q %-TNQ '//@&AQ +3>*BQ 
Ql 9=59DHEIs~c3h/0s s %%56	s
 %-TNs '//@&As +3>*Bs 
sjACD$4 AC ACF/*DIsN+/*5A/*	/*d AE(SM(08(	(V QUDC!667D@HD	DL# , (c l < .# , 6CC+.C;DC	C@W"%W9<W	W Q"Q36Q	Q0S 0T 00S 0T 0 0@/C/C9=%)+0%
sC/0%
 -%
 %%56	%

 c]%
 %)%
 
%
T 0@/C/C9=%)59-%S%"89:- -- %%56	-
 c]- %-TN- 
-d /?/C/C$)%
sC/0%
 %
 -	%

 "%
 
%
T /?/C/C$)F%S%"89:F F -	F
 "F 
FV /?/C/C$)?%S%"89:? ? -	?
 "? 
?B  .0.0%)").GCGC &c]GC 'sm	GC
 c]GC GC #'GC 
GC GCRC C C( RV&"&14&AI#&	&R <@MM+3C=M	M, <@
M
M+3C=
M	
M
| 
(3- L > !%#''"$.?$OP'" S"**_%'" 	'"
 '" C='" 
$'"X !%#'	%S%"89:  C=	
 
d@ !%#'#S"**_%  C=	
  
$8 !%#'#
S"**_%
 
 C=	

 
 
d
: AE(SM(08(	(T CXc] Cc C C6CL C"  -1&*(,0J0J 0J 	0J
 0J %SM0J sm0J !0J 
0J 0Jh -1&*(,	
$SM
 sm
 !	

 

>
$'
 

  7@7J7J C C Cs C C> C# C, C CH !* 3 3&UT'"67sI~9NNOP&U &U 
	&UT .0$(>%c]> SM> 
d3i	>@S S *1<'#s("3 1< 1<f 	+ 	+c 	+d 	+ 	+ + +c +d + +&!'#s("3 ! !*!(3- !D ! &s &t & && Cs C C C C@C C C&CC"C/8C	C:E E3 E< E Ec E E ECC"C/8C	C*HC Hc Hl H H H3 H< H<d<.@ <94+= 9!C!C"!C/8!C	!CF	@# 	@C 	@L 	@	@s 	@ 	@ 	@!C!C"!C/8!C	!CF	BC 	Bc 	Bl 	B	B 	B3 	B< 	Bt  *+l +,l , , .5 56 6 !* 0 0.>.E.E+C+C +C 	+C
 ,+C 
+Cb !* 0 0	,C,C ,C 	,C
 
,Cf '+"RCRC 0RC 	RC
 smRC RC RC 
RCl $($2$8$83B 3B "3B 
d3i	3B 3BrO   rj   )Grc   r2  rj  collectionsr   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   
exceptionsr   http_clientr   r   urlsr   utilsr   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   rl   r8   rd   r9   r=   r  r?   rh  r@   rj   r]   rO   rL   <module>r!     s    
      (  ( / %       > D(#s(#
 kSDcO#LM	c3h')>I IX\3B \3BrO   