Repository: burnash/gspread

Issue:
Remove decorator accepted_kwargs
## Overview
Remove the decorator `accepted_kwargs`. We don't need it and it prevent us from correctly typing the library and using `Enums`.

## Details

The decorator `accepted_kwargs` will filter given `kwargs`.
It will raise an esception is any unknown kwargs is given.
It will set a default value for the kwargs that are not set.

We don't need that, we can simply put them on the command line with a default value.  ( I wonder if that was here for python2 :thinking: )

Then this will allows us to properly use `Enum`s for the arguments like `ValueRenderOption` etc. 

This will make the function `filter_dict_value` obsolete too now as we can pass `None` values as params they won't have any effects.

**This changes should not impact the user**, after the changes the test suite must run like before.
Merging this in 6.0.0 with the rest of the major changes anyway, it is not necessary for the user in v5.Y.Z

## To remove

- function `filter_dict_value`
- decorator `accepted_kwargs`

This issue blocks: #1222 

Discussion:

Patch:
diff --git a/gspread/utils.py b/gspread/utils.py
index cfc2e3b..33e84db 100644
--- a/gspread/utils.py
+++ b/gspread/utils.py
@@ -19,7 +19,6 @@ from typing import (
     Dict,
     Iterable,
     List,
-    NewType,
     Optional,
     Tuple,
     TypeVar,
@@ -664,84 +663,6 @@ def is_scalar(x: Any) -> bool:
     return isinstance(x, str) or not isinstance(x, Sequence)
 
 
-AnyNotNone = NewType("AnyNotNone", object)
-
-
-def filter_dict_values(D: Dict[Any, Any]) -> Dict[Any, AnyNotNone]:
-    """Return a shallow copy of D with all `None` values excluded.
-
-    >>> filter_dict_values({'a': 1, 'b': 2, 'c': None})
-    {'a': 1, 'b': 2}
-
-    >>> filter_dict_values({'a': 1, 'b': 2, 'c': 0})
-    {'a': 1, 'b': 2, 'c': 0}
-
-    >>> filter_dict_values({})
-    {}
-
-    >>> filter_dict_values({'imnone': None})
-    {}
-    """
-    return {k: v for k, v in D.items() if v is not None}
-
-
-def accepted_kwargs(
-    **default_kwargs: Any,
-) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
-    """
-    >>> @accepted_kwargs(d='d', e=None)
-    ... def foo(a, b, c='c', **kwargs):
-    ...     return {
-    ...         'a': a,
-    ...         'b': b,
-    ...         'c': c,
-    ...         'd': kwargs['d'],
-    ...         'e': kwargs['e'],
-    ...     }
-    ...
-
-    >>> foo('a', 'b')
-    {'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd', 'e': None}
-
-    >>> foo('a', 'b', 'NEW C')
-    {'a': 'a', 'b': 'b', 'c': 'NEW C', 'd': 'd', 'e': None}
-
-    >>> foo('a', 'b', e='Not None')
-    {'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd', 'e': 'Not None'}
-
-    >>> foo('a', 'b', d='NEW D')
-    {'a': 'a', 'b': 'b', 'c': 'c', 'd': 'NEW D', 'e': None}
-
-    >>> foo('a', 'b', a_typo='IS DETECTED')
-    Traceback (most recent call last):
-    ...
-    TypeError: foo got unexpected keyword arguments: ['a_typo']
-
-    >>> foo('a', 'b', d='NEW D', c='THIS DOES NOT WORK BECAUSE OF d')
-    Traceback (most recent call last):
-    ...
-    TypeError: foo got unexpected keyword arguments: ['c']
-
-    """
-
-    def decorate(f: Callable[..., Any]) -> Callable[..., Any]:
-        @wraps(f)
-        def wrapper(*args: Any, **kwargs: Any) -> Any:
-            unexpected_kwargs = set(kwargs) - set(default_kwargs)
-            if unexpected_kwargs:
-                err = "%s got unexpected keyword arguments: %s"
-                raise TypeError(err % (f.__name__, list(unexpected_kwargs)))
-
-            for k, v in default_kwargs.items():
-                kwargs.setdefault(k, v)
-
-            return f(*args, **kwargs)
-
-        return wrapper
-
-    return decorate
-
-
 def combined_merge_values(worksheet_metadata, values):
     """For each merged region, replace all values with the value of the top-left cell of the region.
     e.g., replaces
diff --git a/gspread/worksheet.py b/gspread/worksheet.py
index 4cbcba2..f97933d 100644
--- a/gspread/worksheet.py
+++ b/gspread/worksheet.py
@@ -18,12 +18,10 @@ from .utils import (
     a1_range_to_grid_range,
     a1_to_rowcol,
     absolute_range_name,
-    accepted_kwargs,
     cast_to_a1_notation,
     cell_list_to_rect,
     combined_merge_values,
     fill_gaps,
-    filter_dict_values,
     finditem,
     is_scalar,
     numericise_all,
@@ -325,13 +323,14 @@ class Worksheet:
             for j, value in enumerate(row)
         ]
 
-    @accepted_kwargs(
-        major_dimension=None,
+    def get_values(
+        self,
+        range_name=None,
         combine_merged_cells=False,
+        major_dimension=None,
         value_render_option=None,
         date_time_render_option=None,
-    )
-    def get_values(self, range_name=None, combine_merged_cells=False, **kwargs):
+    ):
         """Returns a list of lists containing all values from specified range.
 
         By default values are returned as strings. See ``value_render_option``
@@ -428,7 +427,14 @@ class Worksheet:
             worksheet.get_values('A2:B4', value_render_option=ValueRenderOption.formula)
         """
         try:
-            vals = fill_gaps(self.get(range_name, **kwargs))
+            vals = fill_gaps(
+                self.get(
+                    range_name=range_name,
+                    major_dimension=major_dimension,
+                    value_render_option=value_render_option,
+                    date_time_render_option=date_time_render_option,
+                )
+            )
             if combine_merged_cells is True:
                 spreadsheet_meta = self.client.fetch_sheet_metadata(self.spreadsheet_id)
                 worksheet_meta = finditem(
@@ -440,12 +446,12 @@ class Worksheet:
         except KeyError:
             return []
 
-    @accepted_kwargs(
+    def get_all_values(
+        self,
         major_dimension=None,
         value_render_option=None,
         date_time_render_option=None,
-    )
-    def get_all_values(self, **kwargs):
+    ):
         """Returns a list of lists containing all cells' values as strings.
 
         This is an alias to :meth:`~gspread.worksheet.Worksheet.get_values`
@@ -463,7 +469,11 @@ class Worksheet:
             # Is equivalent to
             worksheet.get_values()
         """
-        return self.get_values(**kwargs)
+        return self.get_values(
+            major_dimension=major_dimension,
+            value_render_option=value_render_option,
+            date_time_render_option=date_time_render_option,
+        )
 
     def get_all_records(
         self,
@@ -559,12 +569,13 @@ class Worksheet:
 
         return self.range()
 
-    @accepted_kwargs(
+    def row_values(
+        self,
+        row,
         major_dimension=None,
         value_render_option=None,
         date_time_render_option=None,
-    )
-    def row_values(self, row, **kwargs):
+    ):
         """Returns a list of all values in a `row`.
 
         Empty cells in this list will be rendered as :const:`None`.
@@ -618,7 +629,12 @@ class Worksheet:
         :type date_time_render_option: :namedtuple:`~gspread.utils.DateTimeOption`
         """
         try:
-            data = self.get("A{}:{}".format(row, row), **kwargs)
+            data = self.get(
+                "A{}:{}".format(row, row),
+                major_dimension,
+                value_render_option,
+                date_time_render_option,
+            )
             return data[0] if data else []
         except KeyError:
             return []
@@ -743,12 +759,13 @@ class Worksheet:
 
         return data
 
-    @accepted_kwargs(
+    def get(
+        self,
+        range_name=None,
         major_dimension=None,
         value_render_option=None,
         date_time_render_option=None,
-    )
-    def get(self, range_name=None, **kwargs):
+    ):
         """Reads values of a single range or a cell of a sheet.
 
          :param str range_name: (optional) Cell range in the A1 notation or
@@ -824,13 +841,11 @@ class Worksheet:
         """
         range_name = absolute_range_name(self.title, range_name)
 
-        params = filter_dict_values(
-            {
-                "majorDimension": kwargs["major_dimension"],
-                "valueRenderOption": kwargs["value_render_option"],
-                "dateTimeRenderOption": kwargs["date_time_render_option"],
-            }
-        )
+        params = {
+            "majorDimension": major_dimension,
+            "valueRenderOption": value_render_option,
+            "dateTimeRenderOption": date_time_render_option,
+        }
 
         response = self.client.values_get(
             self.spreadsheet_id, range_name, params=params
@@ -838,12 +853,13 @@ class Worksheet:
 
         return ValueRange.from_json(response)
 
-    @accepted_kwargs(
+    def batch_get(
+        self,
+        ranges,
         major_dimension=None,
         value_render_option=None,
         date_time_render_option=None,
-    )
-    def batch_get(self, ranges, **kwargs):
+    ):
         """Returns one or more ranges of values from the sheet.
 
         :param list ranges: List of cell ranges in the A1 notation or named
@@ -908,13 +924,11 @@ class Worksheet:
         """
         ranges = [absolute_range_name(self.title, r) for r in ranges if r]
 
-        params = filter_dict_values(
-            {
-                "majorDimension": kwargs["major_dimension"],
-                "valueRenderOption": kwargs["value_render_option"],
-                "dateTimeRenderOption": kwargs["date_time_render_option"],
-            }
-        )
+        params = {
+            "majorDimension": major_dimension,
+            "valueRenderOption": value_render_option,
+            "dateTimeRenderOption": date_time_render_option,
+        }
 
         response = self.client.values_batch_get(
             self.spreadsheet_id, ranges=ranges, params=params
@@ -922,15 +936,17 @@ class Worksheet:
 
         return [ValueRange.from_json(x) for x in response["valueRanges"]]
 
-    @accepted_kwargs(
+    def update(
+        self,
+        range_name,
+        values=None,
         raw=True,
         major_dimension=None,
         value_input_option=None,
         include_values_in_response=None,
         response_value_render_option=None,
         response_date_time_render_option=None,
-    )
-    def update(self, range_name, values=None, **kwargs):
+    ):
         """Sets values in a cell range of the sheet.
 
         :param str range_name: The A1 notation of the values
@@ -1041,41 +1057,36 @@ class Worksheet:
         if is_scalar(values):
             values = [[values]]
 
-        if not kwargs["value_input_option"]:
-            kwargs["value_input_option"] = (
-                ValueInputOption.raw if kwargs["raw"] else ValueInputOption.user_entered
+        if not value_input_option:
+            value_input_option = (
+                ValueInputOption.raw if raw is True else ValueInputOption.user_entered
             )
 
-        params = filter_dict_values(
-            {
-                "valueInputOption": kwargs["value_input_option"],
-                "includeValuesInResponse": kwargs["include_values_in_response"],
-                "responseValueRenderOption": kwargs["response_value_render_option"],
-                "responseDateTimeRenderOption": kwargs[
-                    "response_date_time_render_option"
-                ],
-            }
-        )
+        params = {
+            "valueInputOption": value_input_option,
+            "includeValuesInResponse": include_values_in_response,
+            "responseValueRenderOption": response_value_render_option,
+            "responseDateTimeRenderOption": response_date_time_render_option,
+        }
 
         response = self.client.values_update(
             self.spreadsheet_id,
             range_name,
             params=params,
-            body=filter_dict_values(
-                {"values": values, "majorDimension": kwargs["major_dimension"]}
-            ),
+            body={"values": values, "majorDimension": major_dimension},
         )
 
         return response
 
-    @accepted_kwargs(
+    def batch_update(
+        self,
+        data,
         raw=True,
         value_input_option=None,
         include_values_in_response=None,
         response_value_render_option=None,
         response_date_time_render_option=None,
-    )
-    def batch_update(self, data, **kwargs):
+    ):
         """Sets values in one or more cell ranges of the sheet at once.
 
         :param list data: List of dictionaries in the form of
@@ -1164,26 +1175,22 @@ class Worksheet:
 
         .. versionadded:: 3.3
         """
-        if not kwargs["value_input_option"]:
-            kwargs["value_input_option"] = (
-                ValueInputOption.raw if kwargs["raw"] else ValueInputOption.user_entered
+        if not value_input_option:
+            value_input_option = (
+                ValueInputOption.raw if raw else ValueInputOption.user_entered
             )
 
         data = [
             dict(vr, range=absolute_range_name(self.title, vr["range"])) for vr in data
         ]
 
-        body = filter_dict_values(
-            {
-                "valueInputOption": kwargs["value_input_option"],
-                "includeValuesInResponse": kwargs["include_values_in_response"],
-                "responseValueRenderOption": kwargs["response_value_render_option"],
-                "responseDateTimeRenderOption": kwargs[
-                    "response_date_time_render_option"
-                ],
-                "data": data,
-            }
-        )
+        body = {
+            "valueInputOption": value_input_option,
+            "includeValuesInResponse": include_values_in_response,
+            "responseValueRenderOption": response_value_render_option,
+            "responseDateTimeRenderOption": response_date_time_render_option,
+            "data": data,
+        }
 
         response = self.client.values_batch_update(self.spreadsheet_id, body=body)
 


Test patch:
diff --git a/tests/cassettes/WorksheetTest.test_get_values_with_args_or_kwargs.json b/tests/cassettes/WorksheetTest.test_get_values_with_args_or_kwargs.json
new file mode 100644
index 0000000..6d49684
--- /dev/null
+++ b/tests/cassettes/WorksheetTest.test_get_values_with_args_or_kwargs.json
@@ -0,0 +1,664 @@
+{
+    "version": 1,
+    "interactions": [
+        {
+            "request": {
+                "method": "POST",
+                "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True",
+                "body": "{\"name\": \"Test WorksheetTest test_get_values_with_args_or_kwargs\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}",
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "Content-Length": [
+                        "121"
+                    ],
+                    "Content-Type": [
+                        "application/json"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "no-cache, no-store, max-age=0, must-revalidate"
+                    ],
+                    "Expires": [
+                        "Mon, 01 Jan 1990 00:00:00 GMT"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:44 GMT"
+                    ],
+                    "Pragma": [
+                        "no-cache"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin, X-Origin"
+                    ],
+                    "content-length": [
+                        "208"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"kind\": \"drive#file\",\n  \"id\": \"1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA\",\n  \"name\": \"Test WorksheetTest test_get_values_with_args_or_kwargs\",\n  \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "GET",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA?includeGridData=false",
+                "body": null,
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:44 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "3352"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA\",\n  \"properties\": {\n    \"title\": \"Test WorksheetTest test_get_values_with_args_or_kwargs\",\n    \"locale\": \"en_US\",\n    \"autoRecalc\": \"ON_CHANGE\",\n    \"timeZone\": \"Etc/GMT\",\n    \"defaultFormat\": {\n      \"backgroundColor\": {\n        \"red\": 1,\n        \"green\": 1,\n        \"blue\": 1\n      },\n      \"padding\": {\n        \"top\": 2,\n        \"right\": 3,\n        \"bottom\": 2,\n        \"left\": 3\n      },\n      \"verticalAlignment\": \"BOTTOM\",\n      \"wrapStrategy\": \"OVERFLOW_CELL\",\n      \"textFormat\": {\n        \"foregroundColor\": {},\n        \"fontFamily\": \"arial,sans,sans-serif\",\n        \"fontSize\": 10,\n        \"bold\": false,\n        \"italic\": false,\n        \"strikethrough\": false,\n        \"underline\": false,\n        \"foregroundColorStyle\": {\n          \"rgbColor\": {}\n        }\n      },\n      \"backgroundColorStyle\": {\n        \"rgbColor\": {\n          \"red\": 1,\n          \"green\": 1,\n          \"blue\": 1\n        }\n      }\n    },\n    \"spreadsheetTheme\": {\n      \"primaryFontFamily\": \"Arial\",\n      \"themeColors\": [\n        {\n          \"colorType\": \"TEXT\",\n          \"color\": {\n            \"rgbColor\": {}\n          }\n        },\n        {\n          \"colorType\": \"BACKGROUND\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 1,\n              \"green\": 1,\n              \"blue\": 1\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT1\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.25882354,\n              \"green\": 0.52156866,\n              \"blue\": 0.95686275\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT2\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.91764706,\n              \"green\": 0.2627451,\n              \"blue\": 0.20784314\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT3\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.9843137,\n              \"green\": 0.7372549,\n              \"blue\": 0.015686275\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT4\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.20392157,\n              \"green\": 0.65882355,\n              \"blue\": 0.3254902\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT5\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 1,\n              \"green\": 0.42745098,\n              \"blue\": 0.003921569\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT6\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.27450982,\n              \"green\": 0.7411765,\n              \"blue\": 0.7764706\n            }\n          }\n        },\n        {\n          \"colorType\": \"LINK\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.06666667,\n              \"green\": 0.33333334,\n              \"blue\": 0.8\n            }\n          }\n        }\n      ]\n    }\n  },\n  \"sheets\": [\n    {\n      \"properties\": {\n        \"sheetId\": 0,\n        \"title\": \"Sheet1\",\n        \"index\": 0,\n        \"sheetType\": \"GRID\",\n        \"gridProperties\": {\n          \"rowCount\": 1000,\n          \"columnCount\": 26\n        }\n      }\n    }\n  ],\n  \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA/edit\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "GET",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA?includeGridData=false",
+                "body": null,
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:44 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "3352"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA\",\n  \"properties\": {\n    \"title\": \"Test WorksheetTest test_get_values_with_args_or_kwargs\",\n    \"locale\": \"en_US\",\n    \"autoRecalc\": \"ON_CHANGE\",\n    \"timeZone\": \"Etc/GMT\",\n    \"defaultFormat\": {\n      \"backgroundColor\": {\n        \"red\": 1,\n        \"green\": 1,\n        \"blue\": 1\n      },\n      \"padding\": {\n        \"top\": 2,\n        \"right\": 3,\n        \"bottom\": 2,\n        \"left\": 3\n      },\n      \"verticalAlignment\": \"BOTTOM\",\n      \"wrapStrategy\": \"OVERFLOW_CELL\",\n      \"textFormat\": {\n        \"foregroundColor\": {},\n        \"fontFamily\": \"arial,sans,sans-serif\",\n        \"fontSize\": 10,\n        \"bold\": false,\n        \"italic\": false,\n        \"strikethrough\": false,\n        \"underline\": false,\n        \"foregroundColorStyle\": {\n          \"rgbColor\": {}\n        }\n      },\n      \"backgroundColorStyle\": {\n        \"rgbColor\": {\n          \"red\": 1,\n          \"green\": 1,\n          \"blue\": 1\n        }\n      }\n    },\n    \"spreadsheetTheme\": {\n      \"primaryFontFamily\": \"Arial\",\n      \"themeColors\": [\n        {\n          \"colorType\": \"TEXT\",\n          \"color\": {\n            \"rgbColor\": {}\n          }\n        },\n        {\n          \"colorType\": \"BACKGROUND\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 1,\n              \"green\": 1,\n              \"blue\": 1\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT1\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.25882354,\n              \"green\": 0.52156866,\n              \"blue\": 0.95686275\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT2\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.91764706,\n              \"green\": 0.2627451,\n              \"blue\": 0.20784314\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT3\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.9843137,\n              \"green\": 0.7372549,\n              \"blue\": 0.015686275\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT4\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.20392157,\n              \"green\": 0.65882355,\n              \"blue\": 0.3254902\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT5\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 1,\n              \"green\": 0.42745098,\n              \"blue\": 0.003921569\n            }\n          }\n        },\n        {\n          \"colorType\": \"ACCENT6\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.27450982,\n              \"green\": 0.7411765,\n              \"blue\": 0.7764706\n            }\n          }\n        },\n        {\n          \"colorType\": \"LINK\",\n          \"color\": {\n            \"rgbColor\": {\n              \"red\": 0.06666667,\n              \"green\": 0.33333334,\n              \"blue\": 0.8\n            }\n          }\n        }\n      ]\n    }\n  },\n  \"sheets\": [\n    {\n      \"properties\": {\n        \"sheetId\": 0,\n        \"title\": \"Sheet1\",\n        \"index\": 0,\n        \"sheetType\": \"GRID\",\n        \"gridProperties\": {\n          \"rowCount\": 1000,\n          \"columnCount\": 26\n        }\n      }\n    }\n  ],\n  \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA/edit\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "POST",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA/values/%27Sheet1%27:clear",
+                "body": null,
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "Content-Length": [
+                        "0"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:45 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "107"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA\",\n  \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "POST",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA:batchUpdate",
+                "body": "{\"requests\": [{\"updateSheetProperties\": {\"properties\": {\"sheetId\": 0, \"gridProperties\": {\"rowCount\": 4, \"columnCount\": 4}}, \"fields\": \"gridProperties/rowCount,gridProperties/columnCount\"}}]}",
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "Content-Length": [
+                        "190"
+                    ],
+                    "Content-Type": [
+                        "application/json"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:45 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "97"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA\",\n  \"replies\": [\n    {}\n  ]\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "PUT",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA/values/%27Sheet1%27%21A1%3AD4?valueInputOption=RAW",
+                "body": "{\"values\": [[\"1\", \"\", \"\", \"\"], [\"x\", \"y\", \"title\", \"\"], [\"\", \"\", \"2\", \"\"], [\"num\", \"val\", \"\", \"0\"]], \"majorDimension\": null}",
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "Content-Length": [
+                        "124"
+                    ],
+                    "Content-Type": [
+                        "application/json"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:45 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "169"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA\",\n  \"updatedRange\": \"Sheet1!A1:D4\",\n  \"updatedRows\": 4,\n  \"updatedColumns\": 4,\n  \"updatedCells\": 16\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "GET",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA/values/%27Sheet1%27%21A1%3AD4?valueRenderOption=FORMATTED_VALUE",
+                "body": null,
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:45 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "250"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"range\": \"Sheet1!A1:D4\",\n  \"majorDimension\": \"ROWS\",\n  \"values\": [\n    [\n      \"1\"\n    ],\n    [\n      \"x\",\n      \"y\",\n      \"title\"\n    ],\n    [\n      \"\",\n      \"\",\n      \"2\"\n    ],\n    [\n      \"num\",\n      \"val\",\n      \"\",\n      \"0\"\n    ]\n  ]\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "GET",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA/values/%27Sheet1%27%21A1%3AD4?valueRenderOption=FORMATTED_VALUE",
+                "body": null,
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:45 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "content-length": [
+                        "250"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"range\": \"Sheet1!A1:D4\",\n  \"majorDimension\": \"ROWS\",\n  \"values\": [\n    [\n      \"1\"\n    ],\n    [\n      \"x\",\n      \"y\",\n      \"title\"\n    ],\n    [\n      \"\",\n      \"\",\n      \"2\"\n    ],\n    [\n      \"num\",\n      \"val\",\n      \"\",\n      \"0\"\n    ]\n  ]\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "DELETE",
+                "uri": "https://www.googleapis.com/drive/v3/files/1ZtcOqk9jOY0Qid2XefYoyS-aZUsxGVsvmT8z9SibNYA?supportsAllDrives=True",
+                "body": null,
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "Content-Length": [
+                        "0"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 204,
+                    "message": "No Content"
+                },
+                "headers": {
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Cache-Control": [
+                        "no-cache, no-store, max-age=0, must-revalidate"
+                    ],
+                    "Expires": [
+                        "Mon, 01 Jan 1990 00:00:00 GMT"
+                    ],
+                    "Content-Type": [
+                        "text/html"
+                    ],
+                    "Content-Length": [
+                        "0"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Date": [
+                        "Sun, 18 Jun 2023 13:24:46 GMT"
+                    ],
+                    "Pragma": [
+                        "no-cache"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Vary": [
+                        "Origin, X-Origin"
+                    ]
+                },
+                "body": {
+                    "string": ""
+                }
+            }
+        }
+    ]
+}
diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py
index cb09b83..9907e79 100644
--- a/tests/worksheet_test.py
+++ b/tests/worksheet_test.py
@@ -119,6 +119,30 @@ class WorksheetTest(GspreadTest):
         self.assertEqual(values, sheet_data)
         self.assertEqual(values_with_merged, expected_merge)
 
+    @pytest.mark.vcr()
+    def test_get_values_with_args_or_kwargs(self):
+        # test that get_values accepts args and kwargs
+        self.sheet.resize(4, 4)
+        sheet_data = [
+            ["1", "", "", ""],
+            ["x", "y", "title", ""],
+            ["", "", "2", ""],
+            ["num", "val", "", "0"],
+        ]
+        self.sheet.update("A1:D4", sheet_data)
+
+        data_args = self.sheet.get_values(
+            "A1:D4", False, None, utils.ValueRenderOption.formatted
+        )
+        data_kwargs = self.sheet.get_values(
+            range_name="A1:D4",
+            major_dimension=None,
+            value_render_option=utils.ValueRenderOption.formatted,
+        )
+
+        self.assertEqual(data_args, sheet_data)
+        self.assertEqual(data_kwargs, sheet_data)
+
     @pytest.mark.vcr()
     def test_update_acell(self):
         sg = self._sequence_generator()