Repository: burnash/gspread

Issue:
gspread 6.0.0 no longer compatible with gspread-formatting
**Important**: Please do not post usage questions here. 
To get a quick response, please ask a question on Stack Overflow using `gspread` tag.
See existing questions: https://stackoverflow.com/questions/tagged/gspread

---

**Describe the bug**
gspread 6.0.0 no longer compatible with gspread-formatting. Specifically, `get_conditional_format_rules(worksheet)` raises an `AttributeError: 'Worksheet' object has no attribute 'spreadsheet'. Did you mean: 'spreadsheet_id'?`. I checked and this is because indeed, the `Worksheet` object no longer has the attribute `spreadsheet`, but only `spreadsheet_id` (as one might see when printing `worksheet.__dict__`).

**To Reproduce**
Steps to reproduce the behavior:
1. on gspread 6.0.0 create a spreadsheet
2. worksheet = spreadsheet.get_worksheet(0)
3. worksheet.spreadsheet will raise an error. This is important because the gspread-formatting function, get_conditional_format_rules, uses worksheet.spreadsheet.

**Expected behavior**
I would have expected worksheet to have the attribute `spreadsheet` and that will sort out the incompatibility with gspread-formatting.

**Code example***
If applicable, provide a code example to help explain your problem.
```
import gspread
from gspread_formatting import get_conditional_format_rules

credentials = Credentials.from_service_account_info(<token>, scopes=['https://www.googleapis.com/auth/spreadsheets',
                           'https://www.googleapis.com/auth/drive.file',
                           'https://www.googleapis.com/auth/drive',
                           'https://spreadsheets.google.com/feeds'])
client = gspread.authorize(credentials)
worksheet = client.create(title=<title>, folder_id=<folder_id>)

get_conditional_format_rules(worksheet
```

**Environment info:**
- Operating System macOS:
- Python version 3.10
- gspread version 6.0.0



Discussion:

Patch:
diff --git a/gspread/spreadsheet.py b/gspread/spreadsheet.py
index 09715ff..8c57033 100644
--- a/gspread/spreadsheet.py
+++ b/gspread/spreadsheet.py
@@ -228,7 +228,7 @@ class Spreadsheet:
 
         try:
             properties = sheet_data["sheets"][index]["properties"]
-            return Worksheet(self.id, self.client, properties)
+            return Worksheet(self, properties, self.id, self.client)
         except (KeyError, IndexError):
             raise WorksheetNotFound("index {} not found".format(index))
 
@@ -259,7 +259,7 @@ class Spreadsheet:
                 lambda x: x["properties"]["sheetId"] == worksheet_id_int,
                 sheet_data["sheets"],
             )
-            return Worksheet(self.id, self.client, item["properties"])
+            return Worksheet(self, item["properties"], self.id, self.client)
         except (StopIteration, KeyError):
             raise WorksheetNotFound("id {} not found".format(worksheet_id_int))
 
@@ -276,7 +276,7 @@ class Spreadsheet:
         """
         sheet_data = self.fetch_sheet_metadata()
         worksheets = [
-            Worksheet(self.id, self.client, s["properties"])
+            Worksheet(self, s["properties"], self.id, self.client)
             for s in sheet_data["sheets"]
         ]
         if exclude_hidden:
@@ -307,7 +307,7 @@ class Spreadsheet:
                 lambda x: x["properties"]["title"] == title,
                 sheet_data["sheets"],
             )
-            return Worksheet(self.id, self.client, item["properties"])
+            return Worksheet(self, item["properties"], self.id, self.client)
         except (StopIteration, KeyError):
             raise WorksheetNotFound(title)
 
@@ -349,9 +349,7 @@ class Spreadsheet:
 
         properties = data["replies"][0]["addSheet"]["properties"]
 
-        worksheet = Worksheet(self.id, self.client, properties)
-
-        return worksheet
+        return Worksheet(self, properties, self.id, self.client)
 
     def duplicate_sheet(
         self,
@@ -383,6 +381,7 @@ class Spreadsheet:
             self.client,
             self.id,
             source_sheet_id,
+            self,
             insert_sheet_index=insert_sheet_index,
             new_sheet_id=new_sheet_id,
             new_sheet_name=new_sheet_name,
diff --git a/gspread/worksheet.py b/gspread/worksheet.py
index 8154b9a..a1a29c8 100644
--- a/gspread/worksheet.py
+++ b/gspread/worksheet.py
@@ -9,6 +9,7 @@ This module contains common worksheets' models.
 import re
 import warnings
 from typing import (
+    TYPE_CHECKING,
     Any,
     Callable,
     Dict,
@@ -59,6 +60,9 @@ from .utils import (
     to_records,
 )
 
+if TYPE_CHECKING is True:
+    from .spreadsheet import Spreadsheet
+
 CellFormat = TypedDict(
     "CellFormat",
     {
@@ -157,14 +161,42 @@ class Worksheet:
 
     def __init__(
         self,
-        spreadsheet_id: str,
-        client: HTTPClient,
+        spreadsheet: "Spreadsheet",
         properties: MutableMapping[str, Any],
+        spreadsheet_id: Optional[str] = None,
+        client: Optional[HTTPClient] = None,
     ):
+        # This object is not intended to be created manually
+        # only using gspread code like: spreadsheet.get_worksheet(0)
+        # keep it backward compatible signarure but raise with explicit message
+        # in case of missing new attributes
+
+        if spreadsheet_id is None or "":
+            raise RuntimeError(
+                """Missing spreadsheet_id parameter, it must be provided with a
+                valid spreadsheet ID.
+                Please allocate new Worksheet object using method like:
+                spreadsheet.get_worksheet(0)
+                """
+            )
+
+        if client is None or not isinstance(client, HTTPClient):
+            raise RuntimeError(
+                """Missing 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)
+                """
+            )
+
         self.spreadsheet_id = spreadsheet_id
         self.client = client
         self._properties = properties
 
+        # kept for backward compatibility - publicly available
+        # do not use if possible.
+        self._spreadsheet = spreadsheet
+
     def __repr__(self) -> str:
         return "<{} {} id:{}>".format(
             self.__class__.__name__,
@@ -177,6 +209,11 @@ class Worksheet:
         """Worksheet ID."""
         return self._properties["sheetId"]
 
+    @property
+    def spreadsheet(self) -> "Spreadsheet":
+        """Parent spreadsheet"""
+        return self._spreadsheet
+
     @property
     def title(self) -> str:
         """Worksheet title."""
@@ -2402,6 +2439,7 @@ class Worksheet:
         client: HTTPClient,
         spreadsheet_id: str,
         sheet_id: int,
+        spreadsheet: Any,
         insert_sheet_index: Optional[int] = None,
         new_sheet_id: Optional[int] = None,
         new_sheet_name: Optional[str] = None,
@@ -2444,7 +2482,7 @@ class Worksheet:
 
         properties = data["replies"][0]["duplicateSheet"]["properties"]
 
-        return Worksheet(spreadsheet_id, client, properties)
+        return Worksheet(spreadsheet, properties, spreadsheet_id, client)
 
     def duplicate(
         self,
@@ -2471,6 +2509,7 @@ class Worksheet:
             self.client,
             self.spreadsheet_id,
             self.id,
+            self.spreadsheet,
             insert_sheet_index=insert_sheet_index,
             new_sheet_id=new_sheet_id,
             new_sheet_name=new_sheet_name,


Test patch:
diff --git a/tests/cassettes/WorksheetTest.test_attributes.json b/tests/cassettes/WorksheetTest.test_attributes.json
new file mode 100644
index 0000000..2ba67fd
--- /dev/null
+++ b/tests/cassettes/WorksheetTest.test_attributes.json
@@ -0,0 +1,381 @@
+{
+    "version": 1,
+    "interactions": [
+        {
+            "request": {
+                "method": "POST",
+                "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True",
+                "body": "{\"name\": \"Test WorksheetTest test_attributes\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}",
+                "headers": {
+                    "User-Agent": [
+                        "python-requests/2.31.0"
+                    ],
+                    "Accept-Encoding": [
+                        "gzip, deflate"
+                    ],
+                    "Accept": [
+                        "*/*"
+                    ],
+                    "Connection": [
+                        "keep-alive"
+                    ],
+                    "Content-Length": [
+                        "101"
+                    ],
+                    "Content-Type": [
+                        "application/json"
+                    ],
+                    "authorization": [
+                        "<ACCESS_TOKEN>"
+                    ]
+                }
+            },
+            "response": {
+                "status": {
+                    "code": 200,
+                    "message": "OK"
+                },
+                "headers": {
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Cache-Control": [
+                        "no-cache, no-store, max-age=0, must-revalidate"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Date": [
+                        "Thu, 01 Feb 2024 19:23:23 GMT"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Expires": [
+                        "Mon, 01 Jan 1990 00:00:00 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "Vary": [
+                        "Origin, X-Origin"
+                    ],
+                    "Pragma": [
+                        "no-cache"
+                    ],
+                    "content-length": [
+                        "188"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"kind\": \"drive#file\",\n  \"id\": \"1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k\",\n  \"name\": \"Test WorksheetTest test_attributes\",\n  \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "GET",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k?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": {
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Date": [
+                        "Thu, 01 Feb 2024 19:23:24 GMT"
+                    ],
+                    "x-l2-request-path": [
+                        "l2-managed-6"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "content-length": [
+                        "3332"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k\",\n  \"properties\": {\n    \"title\": \"Test WorksheetTest test_attributes\",\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/1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k/edit\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "GET",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k?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": {
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Date": [
+                        "Thu, 01 Feb 2024 19:23:24 GMT"
+                    ],
+                    "x-l2-request-path": [
+                        "l2-managed-6"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "content-length": [
+                        "3332"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k\",\n  \"properties\": {\n    \"title\": \"Test WorksheetTest test_attributes\",\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/1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k/edit\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "POST",
+                "uri": "https://sheets.googleapis.com/v4/spreadsheets/1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k/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": {
+                    "Transfer-Encoding": [
+                        "chunked"
+                    ],
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Content-Type": [
+                        "application/json; charset=UTF-8"
+                    ],
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Date": [
+                        "Thu, 01 Feb 2024 19:23:25 GMT"
+                    ],
+                    "x-l2-request-path": [
+                        "l2-managed-6"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "Vary": [
+                        "Origin",
+                        "X-Origin",
+                        "Referer"
+                    ],
+                    "Cache-Control": [
+                        "private"
+                    ],
+                    "content-length": [
+                        "107"
+                    ]
+                },
+                "body": {
+                    "string": "{\n  \"spreadsheetId\": \"1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k\",\n  \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n"
+                }
+            }
+        },
+        {
+            "request": {
+                "method": "DELETE",
+                "uri": "https://www.googleapis.com/drive/v3/files/1n9kTJ3vNx8FMrBPX65aRw__2eiVXlThTujgAdHwBg8k?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": {
+                    "X-XSS-Protection": [
+                        "0"
+                    ],
+                    "Content-Length": [
+                        "0"
+                    ],
+                    "Cache-Control": [
+                        "no-cache, no-store, max-age=0, must-revalidate"
+                    ],
+                    "Content-Type": [
+                        "text/html"
+                    ],
+                    "Alt-Svc": [
+                        "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
+                    ],
+                    "Date": [
+                        "Thu, 01 Feb 2024 19:23:26 GMT"
+                    ],
+                    "Server": [
+                        "ESF"
+                    ],
+                    "X-Frame-Options": [
+                        "SAMEORIGIN"
+                    ],
+                    "Expires": [
+                        "Mon, 01 Jan 1990 00:00:00 GMT"
+                    ],
+                    "X-Content-Type-Options": [
+                        "nosniff"
+                    ],
+                    "Vary": [
+                        "Origin, X-Origin"
+                    ],
+                    "Pragma": [
+                        "no-cache"
+                    ]
+                },
+                "body": {
+                    "string": ""
+                }
+            }
+        }
+    ]
+}
diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py
index f8a4bcf..a0d281c 100644
--- a/tests/worksheet_test.py
+++ b/tests/worksheet_test.py
@@ -38,6 +38,16 @@ class WorksheetTest(GspreadTest):
         cell = self.sheet.acell("A1")
         self.assertIsInstance(cell, gspread.cell.Cell)
 
+    @pytest.mark.vcr()
+    def test_attributes(self):
+        self.assertIsInstance(self.sheet.spreadsheet_id, str)
+        self.assertEqual(self.sheet.spreadsheet_id, self.spreadsheet.id)
+
+        self.assertIsInstance(self.sheet.client, gspread.http_client.HTTPClient)
+
+        self.assertIsInstance(self.sheet.spreadsheet, gspread.spreadsheet.Spreadsheet)
+        self.assertEqual(self.sheet.spreadsheet, self.spreadsheet)
+
     @pytest.mark.vcr()
     def test_cell(self):
         cell = self.sheet.cell(1, 1)