From 31789440d5e8b5078e84793e07b900b19e1f5cad Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 1 Dec 2025 20:06:10 -0300 Subject: [PATCH 1/9] * Added create_table method --- gspread/worksheet.py | 102 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index ba9fde0a4..7c92b633f 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -49,6 +49,7 @@ a1_range_to_grid_range, a1_to_rowcol, absolute_range_name, + rowcol_to_a1, cast_to_a1_notation, cell_list_to_rect, combined_merge_values, @@ -3451,3 +3452,104 @@ def expand( values = self.get(pad_values=True) return find_table(values, top_left_range_name, direction) + + def create_table( + self, + range_name: str, + table_name: Optional[str] = None, + column_names: Optional[Sequence[str]] = None, + column_types: Optional[Sequence[str]] = None, + ) -> JSONResponse: + """Create a table in the worksheet. + + This method creates a Google Sheets table entity in the specified range. + Tables provide enhanced functionality like automatic filtering, sorting, + and styling options. + + .. note:: + **IMPORTANT**: As of November 2025, there is a known bug in the Google Sheets API + where column names in `addTableRequest` are positioned with an incorrect offset, + causing headers to not align with their intended columns. This method implements + a two-step workaround: + + 1. Create the table first without column properties + 2. Update the table separately with the correct column properties + + This bug has been reported to Google and may be fixed in a future API update. + See: https://stackoverflow.com/questions/79726262/how-to-fix-offset-column-names-in-addtable-request + + Args: + range_name (str): A1 notation range for the table (e.g., 'A1:D10') + table_name (str, optional): Name for the table. If not provided, + Google Sheets will generate a default name. + column_names (Sequence[str], optional): List of column names. + If not provided, existing values in the first row will be used as headers. + column_types (Sequence[str], optional): List of column types for each column. + + Returns: + dict: API response containing the created table information + + Raises: + GSpreadException: If the table creation fails + + Examples: + >>> worksheet.create_table("A1:D10", "MyTable", ["Name", "Age", "City", "Country"]) + >>> worksheet.create_table("A1:C5") + + .. versionadded:: 6.1.0 + """ + # Step 1: Create table without column properties (workaround for Google Sheets API bug as of Nov 2025) + grid_range = a1_range_to_grid_range(range_name, self.id) + + # Create basic table without column properties first + basic_table = { + "range": grid_range + } + + if table_name: + basic_table["name"] = table_name + + create_body = { + "requests": [ + { + "addTable": { + "table": basic_table + } + } + ] + } + + # Create table and get its ID + create_response = self.client.batch_update(self.spreadsheet_id, create_body) + + # Extract table ID from response + table_id = None + if "replies" in create_response and create_response["replies"]: + add_table_reply = create_response["replies"][0].get("addTable", {}) + table_id = add_table_reply.get("table", {}).get("tableId") + + if not table_id: + raise GSpreadException("Failed to create table or extract table ID") + + # Step 2: Update table with column properties (if provided) + if column_names: + column_properties = [] + for i, name in enumerate(column_names): + col_prop = { + "columnIndex": i, + "columnName": name + } + if column_types and i < len(column_types): + col_prop["columnType"] = column_types[i] + column_properties.append(col_prop) + + # Update table with correct column properties + update_response = self._update_table( + table_id=table_id, + column_properties=column_properties, + fields="columnProperties" + ) + return update_response + + # Return original create response if no column properties to update + return create_response From 49a665bb7b5c3098add34476798f4162a8ffb660 Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 1 Dec 2025 20:11:35 -0300 Subject: [PATCH 2/9] * re added _update_table_method removed from last commit accidentally --- gspread/worksheet.py | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 7c92b633f..b062a60c9 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3553,3 +3553,82 @@ def create_table( # Return original create response if no column properties to update return create_response + + def _update_table( + self, + table_id: str, + table_name: Optional[str] = None, + column_properties: Optional[List[Dict[str, Any]]] = None, + fields: str = "*" + ) -> JSONResponse: + """Internal method to update an existing table. + + This method updates properties of an existing table using the updateTable request. + It's primarily used as a workaround for the Google Sheets API column offset bug. + + Args: + table_id (str): The ID of the table to update + table_name (str, optional): New name for the table + column_properties (List[Dict], optional): List of column properties to update + fields (str): Field mask for which properties to update (default: "*") + + Returns: + dict: API response from the update operation + + .. note:: + This is an internal method used by create_table as a workaround for the + Google Sheets API column offset bug (as of Nov 2025). + """ + table_updates = {} + + if table_name is not None: + table_updates["name"] = table_name + + if column_properties is not None: + table_updates["columnProperties"] = column_properties + + body = { + "requests": [ + { + "updateTable": { + "table": { + "tableId": table_id, + **table_updates + }, + "fields": fields + } + } + ] + } + + return self.client.batch_update(self.spreadsheet_id, body) + + def _find_table_by_name( + self, + table_name: str, + ) -> Optional[Dict[str, Any]]: + """Find a table by its name in the worksheet. + + Args: + table_name (str): The name of the table to find + + Returns: + dict: Table information if found, None otherwise + """ + spreadsheet_metadata = self.client.fetch_sheet_metadata(self.spreadsheet_id) + + # Find the table by name in this worksheet + for sheet in spreadsheet_metadata.get("sheets", []): + if sheet.get("properties", {}).get("sheetId") == self.id: + tables = sheet.get("tables", []) + if isinstance(tables, dict) and "tables" in tables: + tables = tables["tables"] + + for table in tables: + # Table name is directly in the table object, not under tableProperties + if table.get("name") == table_name: + return table + break + + return None + From 62b357cb4fcff8c1f22f753471fafc4f17d935a9 Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 1 Dec 2025 21:05:04 -0300 Subject: [PATCH 3/9] * Added delete_table_row method --- gspread/worksheet.py | 137 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index b062a60c9..5867273d4 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3632,3 +3632,140 @@ def _find_table_by_name( return None + + def delete_table_row( + self, + table_name: str, + row_index: int, + ) -> JSONResponse: + """Delete a row from a table by its index within the table's data rows. + + This method deletes a specific data row from a Google Sheets table entity + without affecting the rest of the spreadsheet. The table structure and + other data rows are preserved, and the table range is adjusted accordingly. + + Args: + table_name (str): The name of the table containing the row to delete + row_index (int): The index of the row to delete within the table's data rows + (0-based, where 0 is the first data row after the header row) + + Returns: + dict: API response from the delete operation + + Raises: + GSpreadException: If the table is not found or the row index is invalid + + Examples: + >>> # Delete the first data row (index 0) from a table named "Users" + >>> worksheet.delete_table_row("Users", 0) + + >>> # Delete the third data row (index 2) from a table named "Inventory" + >>> worksheet.delete_table_row("Inventory", 2) + """ + # Find the table by name + table_info = self._find_table_by_name(table_name) + if not table_info: + raise GSpreadException(f"Table '{table_name}' not found in worksheet") + + # Get table range information + table_range = table_info.get("range", {}) + if not table_range: + raise GSpreadException(f"Table '{table_name}' has no range information") + + # Extract table coordinates + start_row = table_range.get("startRowIndex", 0) + end_row = table_range.get("endRowIndex", 0) + start_col = table_range.get("startColumnIndex", 0) + end_col = table_range.get("endColumnIndex", 0) + + # Calculate table dimensions + total_rows = end_row - start_row + total_cols = end_col - start_col + + # Validate we have at least one data row (after header) + if total_rows <= 1: + raise GSpreadException(f"Table '{table_name}' has no data rows to delete") + + # Validate row index is within data rows bounds (excluding header) + # Data rows are from start_row + 1 to end_row - 1 (for 3-column example: rows 20-22) + data_row_count = total_rows - 1 # Subtract header row + if row_index < 0 or row_index >= data_row_count: + raise GSpreadException( + f"Row index {row_index} is out of bounds for table '{table_name}'. " + f"Table has data rows 0-{data_row_count - 1}" + ) + + # Read current table data + range_start = rowcol_to_a1(start_row + 1, start_col + 1) + range_end = rowcol_to_a1(end_row, end_col) + current_data = self.get(f"{range_start}:{range_end}") + + if not current_data or len(current_data) == 0: + raise GSpreadException(f"Could not read data from table '{table_name}'") + + # Remove the specified data row (index 0 means remove row after header) + # Current data structure: [header_row, data_row_0, data_row_1, ...] + updated_data = current_data.copy() + del updated_data[row_index + 1] # +1 to skip header row + + # Clear the entire table range first + clear_range_start = range_start + clear_range_end = rowcol_to_a1(end_row, end_col) + self.batch_clear([f"{clear_range_start}:{clear_range_end}"]) + + # Write the updated data back (with one less row) + if updated_data: + self.update(updated_data, f"{range_start}:{rowcol_to_a1(start_row + len(updated_data), end_col)}") + + # Update the table definition with new range (one row shorter) + table_id = table_info.get("tableId") + if table_id: + # Calculate new end row (one row less) + new_end_row = end_row - 1 + + # Only update if we actually removed a row + if new_end_row > start_row: + new_range = { + "sheetId": self.id, + "startRowIndex": start_row, + "endRowIndex": new_end_row, + "startColumnIndex": start_col, + "endColumnIndex": end_col + } + + update_table_request = { + "table": { + "tableId": table_id, + "range": new_range + }, + "fields": "range" + } + + body = { + "requests": [ + { + "updateTable": update_table_request + } + ] + } + + response = self.client.batch_update(self.spreadsheet_id, body) + return response + else: + # If table would become too small, delete the entire table + delete_request = { + "tableId": table_id + } + + body = { + "requests": [ + { + "deleteTable": delete_request + } + ] + } + + response = self.client.batch_update(self.spreadsheet_id, body) + return response + + return {"status": "completed", "message": "Row deleted successfully"} From 3f029325891ea77d8b230f941da7a1908c62cc32 Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 4 Dec 2025 16:13:22 -0300 Subject: [PATCH 4/9] Added append_table_rows method --- gspread/worksheet.py | 174 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 5867273d4..c0b47da52 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3769,3 +3769,177 @@ def delete_table_row( return response return {"status": "completed", "message": "Row deleted successfully"} + + def append_table_rows( + self, + table_name: str, + rows_data: Dict[str, List[Any]], + ) -> JSONResponse: + """Append multiple rows to a table from a dictionary of column data. + + This method appends new rows to a Google Sheets table entity from a dictionary + where keys are column names and values are lists of data for that column. + The method handles table expansion if needed and validates that all provided + columns have the same length. + + Args: + table_name (str): The name of the table to append rows to + rows_data (Dict[str, List[Any]]): Dictionary where keys are column names + and values are lists of data to append to each column. All lists must + have the same length. Not all table columns need to be provided. + + Returns: + dict: API response from the append operation + + Raises: + GSpreadException: If table is not found, columns are invalid, or data lengths differ + + Examples: + >>> # Append two rows to a table with Name, Age, and City columns + >>> worksheet.append_table_rows("Users", { + ... "Name": ["Alice", "Bob"], + ... "Age": [25, 30], + ... "City": ["New York", "San Francisco"] + ... }) + + >>> # Append one row with only some columns + >>> worksheet.append_table_rows("Inventory", { + ... "Product": ["Widget"], + ... "Price": [19.99] + ... }) + """ + if not rows_data: + raise GSpreadException("No data provided to append") + + # Validate that all lists have the same length + list_lengths = [len(values) for values in rows_data.values()] + if len(set(list_lengths)) > 1: + raise GSpreadException( + f"All column lists must have the same length. " + f"Found lengths: {dict(zip(rows_data.keys(), list_lengths))}" + ) + + num_rows_to_add = list_lengths[0] if list_lengths else 0 + if num_rows_to_add == 0: + return {"status": "completed", "message": "No rows to append"} + + # Find the table by name + table_info = self._find_table_by_name(table_name) + if not table_info: + raise GSpreadException(f"Table '{table_name}' not found in worksheet") + + # Get table range and column information + table_range = table_info.get("range", {}) + if not table_range: + raise GSpreadException(f"Table '{table_name}' has no range information") + + # Extract table coordinates + start_row = table_range.get("startRowIndex", 0) + end_row = table_range.get("endRowIndex", 0) + start_col = table_range.get("startColumnIndex", 0) + end_col = table_range.get("endColumnIndex", 0) + + # Calculate table dimensions + total_rows = end_row - start_row + total_cols = end_col - start_col + + # Get table column properties to map column names to indices + table_columns = table_info.get("columnProperties", []) + column_name_to_index = {} + table_column_names = set() + + for col_prop in table_columns: + col_name = col_prop.get("columnName", "") + col_index = col_prop.get("columnIndex", 0) + column_name_to_index[col_name] = col_index + table_column_names.add(col_name) + + # Validate provided column names exist in the table + invalid_columns = set(rows_data.keys()) - table_column_names + if invalid_columns: + raise GSpreadException( + f"Invalid column names: {invalid_columns}. " + f"Available columns: {sorted(table_column_names)}" + ) + + # Read current table data including headers + range_start = rowcol_to_a1(start_row + 1, start_col + 1) + range_end = rowcol_to_a1(end_row, end_col) + current_data = self.get(f"{range_start}:{range_end}") + + if not current_data or len(current_data) == 0: + raise GSpreadException(f"Could not read data from table '{table_name}'") + + # Extract headers from first row + headers = current_data[0] if current_data else [] + data_rows = current_data[1:] if len(current_data) > 1 else [] + + # Calculate how many empty rows are available in the current table + current_data_rows_count = len(data_rows) + available_empty_rows = total_rows - 1 - current_data_rows_count # -1 for header + + # Determine if we need to expand the table + rows_to_create = max(0, num_rows_to_add - available_empty_rows) + + # Expand table range if needed + if rows_to_create > 0: + new_end_row = end_row + rows_to_create + new_range = { + "sheetId": self.id, + "startRowIndex": start_row, + "endRowIndex": new_end_row, + "startColumnIndex": start_col, + "endColumnIndex": end_col + } + + table_id = table_info.get("tableId") + if table_id: + update_table_request = { + "table": { + "tableId": table_id, + "range": new_range + }, + "fields": "range" + } + + body = { + "requests": [ + { + "updateTable": update_table_request + } + ] + } + + self.client.batch_update(self.spreadsheet_id, body) + end_row = new_end_row # Update end_row for further operations + + # Prepare the new rows to append + new_rows = [] + for row_idx in range(num_rows_to_add): + new_row = [""] * total_cols # Initialize with empty strings for all columns + + # Fill in the data for provided columns + for column_name, values in rows_data.items(): + col_index = column_name_to_index[column_name] + if col_index < total_cols: + new_row[col_index] = values[row_idx] + + new_rows.append(new_row) + + + # Calculate where to start writing the new rows + if available_empty_rows > 0: + # Use the first empty row within existing table range + first_new_row_index = start_row + 1 + current_data_rows_count + else: + # Need to expand table, write to the new row + first_new_row_index = start_row + 1 + current_data_rows_count + + range_start_write = rowcol_to_a1(first_new_row_index + 1, start_col + 1) + range_end_write = rowcol_to_a1(first_new_row_index + num_rows_to_add, end_col) + + # Write the new rows to the table + if new_rows: + self.update(new_rows, f"{range_start_write}:{range_end_write}") + + return {"status": "completed", "message": f"Successfully appended {num_rows_to_add} rows to table '{table_name}'"} From 5eae69ae805c4fad4bc3acb8fb96cebed2161ada Mon Sep 17 00:00:00 2001 From: Pedro Date: Sat, 6 Dec 2025 17:25:25 -0300 Subject: [PATCH 5/9] *Added update_table_rows * Added footer handling when adding rows --- gspread/worksheet.py | 201 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 194 insertions(+), 7 deletions(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index c0b47da52..55ee40f8c 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3681,18 +3681,23 @@ def delete_table_row( # Calculate table dimensions total_rows = end_row - start_row total_cols = end_col - start_col + + # Check if table has a footer row + has_footer = bool(table_info.get("rowsProperties", {}).get("footerColorStyle")) + footer_rows = 1 if has_footer else 0 # Validate we have at least one data row (after header) - if total_rows <= 1: - raise GSpreadException(f"Table '{table_name}' has no data rows to delete") + min_rows_needed = 1 + footer_rows # Header + footer + if total_rows <= min_rows_needed: + raise GSpreadException(f"Table '{table_name}' has no data rows to delete (header + footer only)") # Validate row index is within data rows bounds (excluding header) # Data rows are from start_row + 1 to end_row - 1 (for 3-column example: rows 20-22) - data_row_count = total_rows - 1 # Subtract header row + data_row_count = total_rows - 1 - footer_rows # Subtract header and footer rows if row_index < 0 or row_index >= data_row_count: raise GSpreadException( f"Row index {row_index} is out of bounds for table '{table_name}'. " - f"Table has data rows 0-{data_row_count - 1}" + f"Table has data rows 0-{data_row_count - 1} (excluding footer rows)" ) # Read current table data @@ -3701,10 +3706,17 @@ def delete_table_row( current_data = self.get(f"{range_start}:{range_end}") if not current_data or len(current_data) == 0: - raise GSpreadException(f"Could not read data from table '{table_name}'") + raise GSpreadException(f"Could not read data from table '{table_name}'")# Protect footer from accidental deletion + if has_footer: + max_data_index = len(current_data) - 2 # -2 for header and footer + if row_index >= max_data_index: + raise GSpreadException( + f"Cannot delete row index {row_index} - it would delete the footer row. " + f"Maximum deletable data row index: {max_data_index - 1}" + ) # Remove the specified data row (index 0 means remove row after header) - # Current data structure: [header_row, data_row_0, data_row_1, ...] + # Current data structure: [header_row, data_row_0, data_row_1, ..., footer_row] updated_data = current_data.copy() del updated_data[row_index + 1] # +1 to skip header row @@ -3874,9 +3886,18 @@ def append_table_rows( headers = current_data[0] if current_data else [] data_rows = current_data[1:] if len(current_data) > 1 else [] + # Check if table has a footer row + has_footer = bool(table_info.get("rowsProperties", {}).get("footerColorStyle")) + footer_rows = 1 if has_footer else 0 + + # Remove footer row from data rows if it exists + if has_footer and data_rows: + data_rows = data_rows[:-1] # Remove the last row (footer) + + # Calculate how many empty rows are available in the current table current_data_rows_count = len(data_rows) - available_empty_rows = total_rows - 1 - current_data_rows_count # -1 for header + available_empty_rows = total_rows - 1 - footer_rows - current_data_rows_count # -1 for header, -footer_rows for footer # Determine if we need to expand the table rows_to_create = max(0, num_rows_to_add - available_empty_rows) @@ -3943,3 +3964,169 @@ def append_table_rows( self.update(new_rows, f"{range_start_write}:{range_end_write}") return {"status": "completed", "message": f"Successfully appended {num_rows_to_add} rows to table '{table_name}'"} + + def update_table_rows( + self, + table_name: str, + columns_to_match: Dict[str, List[Any]], + columns_to_modify: Dict[str, Any], + or_logical: bool = False, + ) -> JSONResponse: + """Update rows in a table based on matching conditions. + + This method finds rows in a Google Sheets table that match the specified conditions + and updates the specified columns with new values. The method supports flexible + matching logic between columns. + + Args: + table_name (str): The name of the table to update + columns_to_match (Dict[str, List[Any]]): Dictionary containing match conditions + where keys are column names and values are lists of possible matching values. + For each column, a row matches if the cell value matches ANY value in the list. + Example: {'Type': ['A', 'B'], 'Status': ['Active', 'Pending']} + columns_to_modify (Dict[str, Any]): Dictionary containing column names as keys + and the values to set in those columns for matching rows. + Example: {'Status': 'Inactive', 'Notes': 'Updated automatically'} + or_logical (bool, optional): Determines how multiple column conditions are combined. + If False (default), ALL specified columns must match (AND logic). + If True, ANY specified column matching is sufficient (OR logic). + Defaults to False. + + Returns: + dict: API response containing the number of rows updated + + Raises: + GSpreadException: If the table is not found or columns are invalid + + Examples: + >>> # Update Status to 'Inactive' for rows where Type is 'A' AND Status is 'Active' + >>> worksheet.update_table_rows( + ... "Users", + ... {'Type': ['A'], 'Status': ['Active']}, + ... {'Status': 'Inactive'} + ... ) + + >>> # Update with OR logic - rows where Type is 'A' OR Status is 'Active' + >>> worksheet.update_table_rows( + ... "Users", + ... {'Type': ['A'], 'Status': ['Active']}, + ... {'Status': 'Updated'}, + ... or_logical=True + ... ) + + >>> # Update multiple columns with multiple possible values per column + >>> worksheet.update_table_rows( + ... "Inventory", + ... {'Category': ['Electronics', 'Books'], 'Priority': ['High', 'Urgent']}, + ... {'Notes': 'Review needed'} + ... ) + + >>> # Update with single column match + >>> worksheet.update_table_rows( + ... "Employees", + ... {'Department': ['Sales']}, + ... {'Bonus': 5000, 'Status': 'Eligible'} + ... ) + """ + # Find the table by name + table_info = self._find_table_by_name(table_name) + if not table_info: + raise GSpreadException(f"Table '{table_name}' not found in worksheet") + + # Get table range information + table_range = table_info.get("range", {}) + if not table_range: + raise GSpreadException(f"Table '{table_name}' has no range information") + + # Extract table coordinates + start_row = table_range.get("startRowIndex", 0) + end_row = table_range.get("endRowIndex", 0) + start_col = table_range.get("startColumnIndex", 0) + end_col = table_range.get("endColumnIndex", 0) + + # Calculate table dimensions + total_rows = end_row - start_row + total_cols = end_col - start_col + + # Read current table data including headers + range_start = rowcol_to_a1(start_row + 1, start_col + 1) + range_end = rowcol_to_a1(end_row, end_col) + current_data = self.get(f"{range_start}:{range_end}") + + if not current_data or len(current_data) == 0: + raise GSpreadException(f"Could not read data from table '{table_name}'") + + # Extract header row and create column mapping + header_row = current_data[0] + column_name_to_index = {col.strip(): idx for idx, col in enumerate(header_row)} + data_rows = current_data[1:] # All rows except header + + # Validate all columns exist in the table + all_columns = set(columns_to_match.keys()) + all_columns.update(columns_to_modify.keys()) + + for col in all_columns: + if col not in column_name_to_index: + raise GSpreadException(f"Column '{col}' not found in table '{table_name}'") + + # Find matching rows + matching_row_indices = [] + for row_idx, row in enumerate(data_rows): + row_matches = False + + if not columns_to_match: + # If no match conditions, all rows match + row_matches = True + else: + # Check column conditions based on or_logical parameter + matching_columns = 0 + total_columns = len(columns_to_match) + + for col_name, match_values in columns_to_match.items(): + col_index = column_name_to_index[col_name] + cell_value = row[col_index] if col_index < len(row) else "" + + # Check if cell value matches any of the provided values for this column + if str(cell_value).strip() in [str(v).strip() for v in match_values]: + matching_columns += 1 + + # For OR logic, one match is enough + if or_logical: + row_matches = True + break + + # For AND logic, all columns must match + if not or_logical and matching_columns == total_columns: + row_matches = True + + if row_matches: + matching_row_indices.append(row_idx) + + if not matching_row_indices: + return {"status": "completed", "message": f"No rows matched the specified conditions in table '{table_name}'", "rows_updated": 0} + + # Prepare updates for matching rows + updates = [] + for row_idx in matching_row_indices: + for col_name, new_value in columns_to_modify.items(): + col_index = column_name_to_index[col_name] + actual_row = start_row + 1 + row_idx # +1 for header, +row_idx for data row + actual_col = start_col + col_index + + # Create A1 notation for the cell + cell_range = rowcol_to_a1(actual_row + 1, actual_col + 1) # +1 for A1 conversion + + updates.append({ + 'range': cell_range, + 'values': [[new_value]] + }) + + # Apply all updates in a batch + if updates: + self.batch_update(updates) + + return { + "status": "completed", + "message": f"Successfully updated {len(matching_row_indices)} rows in table '{table_name}'", + "rows_updated": len(matching_row_indices) + } \ No newline at end of file From 86fa9558eefb9922c18a5973e47e1e4c8a383d69 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 10 Dec 2025 20:24:41 -0300 Subject: [PATCH 6/9] * Fixed table row deletion when table has footer --- gspread/worksheet.py | 207 +++++++++++++++++++++++-------------------- 1 file changed, 111 insertions(+), 96 deletions(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 55ee40f8c..0baf21099 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3641,8 +3641,7 @@ def delete_table_row( """Delete a row from a table by its index within the table's data rows. This method deletes a specific data row from a Google Sheets table entity - without affecting the rest of the spreadsheet. The table structure and - other data rows are preserved, and the table range is adjusted accordingly. + using table entity operations that preserve footer content and table structure. Args: table_name (str): The name of the table containing the row to delete @@ -3658,130 +3657,146 @@ def delete_table_row( Examples: >>> # Delete the first data row (index 0) from a table named "Users" >>> worksheet.delete_table_row("Users", 0) - - >>> # Delete the third data row (index 2) from a table named "Inventory" - >>> worksheet.delete_table_row("Inventory", 2) """ # Find the table by name table_info = self._find_table_by_name(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") - # Get table range information + table_id = table_info.get("tableId") table_range = table_info.get("range", {}) - if not table_range: - raise GSpreadException(f"Table '{table_name}' has no range information") - - # Extract table coordinates start_row = table_range.get("startRowIndex", 0) end_row = table_range.get("endRowIndex", 0) - start_col = table_range.get("startColumnIndex", 0) + start_col = table_range.get("startColumnIndex", 0) end_col = table_range.get("endColumnIndex", 0) - # Calculate table dimensions - total_rows = end_row - start_row - total_cols = end_col - start_col + # Read current table data + range_start = rowcol_to_a1(start_row + 1, 1) # col 1 = A + range_end = rowcol_to_a1(end_row, 3) # col 3 = C + current_data = self.get(f"{range_start}:{range_end}") + + if not current_data or len(current_data) == 0: + raise GSpreadException(f"Could not read data from table '{table_name}'") + + # Extract headers and data rows + headers = current_data[0] if current_data else [] + data_rows = current_data[1:] if len(current_data) > 1 else [] # Check if table has a footer row has_footer = bool(table_info.get("rowsProperties", {}).get("footerColorStyle")) - footer_rows = 1 if has_footer else 0 - - # Validate we have at least one data row (after header) - min_rows_needed = 1 + footer_rows # Header + footer - if total_rows <= min_rows_needed: - raise GSpreadException(f"Table '{table_name}' has no data rows to delete (header + footer only)") - - # Validate row index is within data rows bounds (excluding header) - # Data rows are from start_row + 1 to end_row - 1 (for 3-column example: rows 20-22) - data_row_count = total_rows - 1 - footer_rows # Subtract header and footer rows - if row_index < 0 or row_index >= data_row_count: + + # Separate footer from data rows if it exists + if has_footer and data_rows: + footer_row = data_rows[-1] # Save the footer row content + data_rows = data_rows[:-1] # Remove the last row (footer) + else: + footer_row = None + + # Validate we have at least one data row + if len(data_rows) == 0: + raise GSpreadException(f"Table '{table_name}' has no data rows to delete") + + # Validate row index + if row_index < 0 or row_index >= len(data_rows): raise GSpreadException( f"Row index {row_index} is out of bounds for table '{table_name}'. " - f"Table has data rows 0-{data_row_count - 1} (excluding footer rows)" + f"Table has data rows 0-{len(data_rows) - 1}" ) - # Read current table data - range_start = rowcol_to_a1(start_row + 1, start_col + 1) - range_end = rowcol_to_a1(end_row, end_col) - current_data = self.get(f"{range_start}:{range_end}") + # TABLE ENTITY APPROACH: + # Use Google Sheets API to delete specific cells within the table range + # This should preserve table structure and footer relationships - if not current_data or len(current_data) == 0: - raise GSpreadException(f"Could not read data from table '{table_name}'")# Protect footer from accidental deletion - if has_footer: - max_data_index = len(current_data) - 2 # -2 for header and footer - if row_index >= max_data_index: - raise GSpreadException( - f"Cannot delete row index {row_index} - it would delete the footer row. " - f"Maximum deletable data row index: {max_data_index - 1}" - ) + # Calculate the actual row number to delete (0-based) + header_row = start_row # Header row index + data_row_to_delete = header_row + 1 + row_index # +1 for header, +row_index for data row - # Remove the specified data row (index 0 means remove row after header) - # Current data structure: [header_row, data_row_0, data_row_1, ..., footer_row] - updated_data = current_data.copy() - del updated_data[row_index + 1] # +1 to skip header row + # Create a delete range request for the specific row + delete_range = { + "sheetId": self.id, + "startRowIndex": data_row_to_delete, + "endRowIndex": data_row_to_delete + 1, # Delete only this row + "startColumnIndex": start_col, # Same columns as table + "endColumnIndex": end_col + } - # Clear the entire table range first - clear_range_start = range_start - clear_range_end = rowcol_to_a1(end_row, end_col) - self.batch_clear([f"{clear_range_start}:{clear_range_end}"]) + # Move rows up - shift all rows below the deleted row up by 1 + total_data_rows = len(data_rows) + rows_below_deleted = total_data_rows - row_index - 1 - # Write the updated data back (with one less row) - if updated_data: - self.update(updated_data, f"{range_start}:{rowcol_to_a1(start_row + len(updated_data), end_col)}") + if rows_below_deleted > 0: + # Create update requests to shift rows up + update_requests = [] - # Update the table definition with new range (one row shorter) - table_id = table_info.get("tableId") - if table_id: - # Calculate new end row (one row less) - new_end_row = end_row - 1 - - # Only update if we actually removed a row - if new_end_row > start_row: - new_range = { + for i in range(rows_below_deleted): + source_row = data_row_to_delete + 1 + i # Row below deleted row + target_row = data_row_to_delete + i # Where to move it + + # Copy data from source row to target row + source_range = { "sheetId": self.id, - "startRowIndex": start_row, - "endRowIndex": new_end_row, + "startRowIndex": source_row, + "endRowIndex": source_row + 1, "startColumnIndex": start_col, "endColumnIndex": end_col } - - update_table_request = { - "table": { - "tableId": table_id, - "range": new_range - }, - "fields": "range" - } - - body = { - "requests": [ - { - "updateTable": update_table_request - } - ] - } - - response = self.client.batch_update(self.spreadsheet_id, body) - return response - else: - # If table would become too small, delete the entire table - delete_request = { - "tableId": table_id + + target_range = { + "sheetId": self.id, + "startRowIndex": target_row, + "endRowIndex": target_row + 1, + "startColumnIndex": start_col, + "endColumnIndex": end_col } - - body = { - "requests": [ - { - "deleteTable": delete_request - } - ] + + update_requests.append({ + "copyPaste": { + "source": source_range, + "destination": target_range, + "pasteType": "PASTE_VALUES" + } + }) + + # Execute the row shifting operations + if update_requests: + shift_body = {"requests": update_requests} + self.client.batch_update(self.spreadsheet_id, shift_body) + + # Clear the now-empty row at the bottom + empty_row = header_row + len(data_rows) # Last data row position + clear_range = rowcol_to_a1(empty_row + 1, start_col + 1) + ":" + rowcol_to_a1(empty_row + 1, end_col) + + self.batch_clear([clear_range]) + + # Update table definition with new range (one row shorter) + new_end_row = end_row - 1 + new_table_range = { + "sheetId": self.id, + "startRowIndex": start_row, + "endRowIndex": new_end_row, + "startColumnIndex": start_col, + "endColumnIndex": end_col + } + + update_table_request = { + "table": { + "tableId": table_id, + "range": new_table_range + }, + "fields": "range" + } + + body = { + "requests": [ + { + "updateTable": update_table_request } - - response = self.client.batch_update(self.spreadsheet_id, body) - return response - - return {"status": "completed", "message": "Row deleted successfully"} + ] + } + response = self.client.batch_update(self.spreadsheet_id, body) + return response + def append_table_rows( self, table_name: str, From 1cfbe35234505e8f3ac12a505c1e098fd35bef21 Mon Sep 17 00:00:00 2001 From: Pedro Date: Fri, 12 Dec 2025 23:31:56 -0300 Subject: [PATCH 7/9] * Added tests --- gspread/worksheet.py | 162 +- ...heetTest.test_append_table_rows_basic.json | 886 +++++++++++ ...est_append_table_rows_partial_columns.json | 886 +++++++++++ ...WorksheetTest.test_create_table_basic.json | 524 +++++++ ...rksheetTest.test_create_table_minimal.json | 524 +++++++ ...t.test_create_table_with_column_names.json | 600 ++++++++ ...sheetTest.test_delete_table_row_basic.json | 962 ++++++++++++ ....test_delete_table_row_first_and_last.json | 1324 +++++++++++++++++ ...e_table_rows_multiple_match_and_logic.json | 810 ++++++++++ ...te_table_rows_multiple_match_or_logic.json | 810 ++++++++++ ...t.test_update_table_rows_single_match.json | 810 ++++++++++ tests/conftest.py | 14 +- tests/worksheet_test.py | 350 +++++ 13 files changed, 8571 insertions(+), 91 deletions(-) create mode 100644 tests/cassettes/WorksheetTest.test_append_table_rows_basic.json create mode 100644 tests/cassettes/WorksheetTest.test_append_table_rows_partial_columns.json create mode 100644 tests/cassettes/WorksheetTest.test_create_table_basic.json create mode 100644 tests/cassettes/WorksheetTest.test_create_table_minimal.json create mode 100644 tests/cassettes/WorksheetTest.test_create_table_with_column_names.json create mode 100644 tests/cassettes/WorksheetTest.test_delete_table_row_basic.json create mode 100644 tests/cassettes/WorksheetTest.test_delete_table_row_first_and_last.json create mode 100644 tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_and_logic.json create mode 100644 tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_or_logic.json create mode 100644 tests/cassettes/WorksheetTest.test_update_table_rows_single_match.json diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 0baf21099..081cb970a 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -49,7 +49,6 @@ a1_range_to_grid_range, a1_to_rowcol, absolute_range_name, - rowcol_to_a1, cast_to_a1_notation, cell_list_to_rect, combined_merge_values, @@ -3502,22 +3501,12 @@ def create_table( grid_range = a1_range_to_grid_range(range_name, self.id) # Create basic table without column properties first - basic_table = { - "range": grid_range - } + basic_table = {"range": grid_range} if table_name: basic_table["name"] = table_name - create_body = { - "requests": [ - { - "addTable": { - "table": basic_table - } - } - ] - } + create_body = {"requests": [{"addTable": {"table": basic_table}}]} # Create table and get its ID create_response = self.client.batch_update(self.spreadsheet_id, create_body) @@ -3535,10 +3524,7 @@ def create_table( if column_names: column_properties = [] for i, name in enumerate(column_names): - col_prop = { - "columnIndex": i, - "columnName": name - } + col_prop = {"columnIndex": i, "columnName": name} if column_types and i < len(column_types): col_prop["columnType"] = column_types[i] column_properties.append(col_prop) @@ -3547,7 +3533,7 @@ def create_table( update_response = self._update_table( table_id=table_id, column_properties=column_properties, - fields="columnProperties" + fields="columnProperties", ) return update_response @@ -3559,7 +3545,7 @@ def _update_table( table_id: str, table_name: Optional[str] = None, column_properties: Optional[List[Dict[str, Any]]] = None, - fields: str = "*" + fields: str = "*", ) -> JSONResponse: """Internal method to update an existing table. @@ -3591,11 +3577,8 @@ def _update_table( "requests": [ { "updateTable": { - "table": { - "tableId": table_id, - **table_updates - }, - "fields": fields + "table": {"tableId": table_id, **table_updates}, + "fields": fields, } } ] @@ -3632,7 +3615,6 @@ def _find_table_by_name( return None - def delete_table_row( self, table_name: str, @@ -3709,7 +3691,9 @@ def delete_table_row( # Calculate the actual row number to delete (0-based) header_row = start_row # Header row index - data_row_to_delete = header_row + 1 + row_index # +1 for header, +row_index for data row + data_row_to_delete = ( + header_row + 1 + row_index + ) # +1 for header, +row_index for data row # Create a delete range request for the specific row delete_range = { @@ -3717,7 +3701,7 @@ def delete_table_row( "startRowIndex": data_row_to_delete, "endRowIndex": data_row_to_delete + 1, # Delete only this row "startColumnIndex": start_col, # Same columns as table - "endColumnIndex": end_col + "endColumnIndex": end_col, } # Move rows up - shift all rows below the deleted row up by 1 @@ -3730,7 +3714,7 @@ def delete_table_row( for i in range(rows_below_deleted): source_row = data_row_to_delete + 1 + i # Row below deleted row - target_row = data_row_to_delete + i # Where to move it + target_row = data_row_to_delete + i # Where to move it # Copy data from source row to target row source_range = { @@ -3738,7 +3722,7 @@ def delete_table_row( "startRowIndex": source_row, "endRowIndex": source_row + 1, "startColumnIndex": start_col, - "endColumnIndex": end_col + "endColumnIndex": end_col, } target_range = { @@ -3746,16 +3730,18 @@ def delete_table_row( "startRowIndex": target_row, "endRowIndex": target_row + 1, "startColumnIndex": start_col, - "endColumnIndex": end_col + "endColumnIndex": end_col, } - update_requests.append({ - "copyPaste": { - "source": source_range, - "destination": target_range, - "pasteType": "PASTE_VALUES" + update_requests.append( + { + "copyPaste": { + "source": source_range, + "destination": target_range, + "pasteType": "PASTE_VALUES", + } } - }) + ) # Execute the row shifting operations if update_requests: @@ -3764,7 +3750,11 @@ def delete_table_row( # Clear the now-empty row at the bottom empty_row = header_row + len(data_rows) # Last data row position - clear_range = rowcol_to_a1(empty_row + 1, start_col + 1) + ":" + rowcol_to_a1(empty_row + 1, end_col) + clear_range = ( + rowcol_to_a1(empty_row + 1, start_col + 1) + + ":" + + rowcol_to_a1(empty_row + 1, end_col) + ) self.batch_clear([clear_range]) @@ -3775,28 +3765,19 @@ def delete_table_row( "startRowIndex": start_row, "endRowIndex": new_end_row, "startColumnIndex": start_col, - "endColumnIndex": end_col + "endColumnIndex": end_col, } update_table_request = { - "table": { - "tableId": table_id, - "range": new_table_range - }, - "fields": "range" + "table": {"tableId": table_id, "range": new_table_range}, + "fields": "range", } - body = { - "requests": [ - { - "updateTable": update_table_request - } - ] - } + body = {"requests": [{"updateTable": update_table_request}]} response = self.client.batch_update(self.spreadsheet_id, body) return response - + def append_table_rows( self, table_name: str, @@ -3804,14 +3785,14 @@ def append_table_rows( ) -> JSONResponse: """Append multiple rows to a table from a dictionary of column data. - This method appends new rows to a Google Sheets table entity from a dictionary + This method appends new rows to a Google Sheets table entity from a dictionary where keys are column names and values are lists of data for that column. The method handles table expansion if needed and validates that all provided columns have the same length. Args: table_name (str): The name of the table to append rows to - rows_data (Dict[str, List[Any]]): Dictionary where keys are column names + rows_data (Dict[str, List[Any]]): Dictionary where keys are column names and values are lists of data to append to each column. All lists must have the same length. Not all table columns need to be provided. @@ -3828,7 +3809,7 @@ def append_table_rows( ... "Age": [25, 30], ... "City": ["New York", "San Francisco"] ... }) - + >>> # Append one row with only some columns >>> worksheet.append_table_rows("Inventory", { ... "Product": ["Widget"], @@ -3845,7 +3826,7 @@ def append_table_rows( f"All column lists must have the same length. " f"Found lengths: {dict(zip(rows_data.keys(), list_lengths))}" ) - + num_rows_to_add = list_lengths[0] if list_lengths else 0 if num_rows_to_add == 0: return {"status": "completed", "message": "No rows to append"} @@ -3874,7 +3855,7 @@ def append_table_rows( table_columns = table_info.get("columnProperties", []) column_name_to_index = {} table_column_names = set() - + for col_prop in table_columns: col_name = col_prop.get("columnName", "") col_index = col_prop.get("columnIndex", 0) @@ -3909,10 +3890,11 @@ def append_table_rows( if has_footer and data_rows: data_rows = data_rows[:-1] # Remove the last row (footer) - # Calculate how many empty rows are available in the current table current_data_rows_count = len(data_rows) - available_empty_rows = total_rows - 1 - footer_rows - current_data_rows_count # -1 for header, -footer_rows for footer + available_empty_rows = ( + total_rows - 1 - footer_rows - current_data_rows_count + ) # -1 for header, -footer_rows for footer # Determine if we need to expand the table rows_to_create = max(0, num_rows_to_add - available_empty_rows) @@ -3925,27 +3907,18 @@ def append_table_rows( "startRowIndex": start_row, "endRowIndex": new_end_row, "startColumnIndex": start_col, - "endColumnIndex": end_col + "endColumnIndex": end_col, } - + table_id = table_info.get("tableId") if table_id: update_table_request = { - "table": { - "tableId": table_id, - "range": new_range - }, - "fields": "range" - } - - body = { - "requests": [ - { - "updateTable": update_table_request - } - ] + "table": {"tableId": table_id, "range": new_range}, + "fields": "range", } - + + body = {"requests": [{"updateTable": update_table_request}]} + self.client.batch_update(self.spreadsheet_id, body) end_row = new_end_row # Update end_row for further operations @@ -3953,15 +3926,14 @@ def append_table_rows( new_rows = [] for row_idx in range(num_rows_to_add): new_row = [""] * total_cols # Initialize with empty strings for all columns - + # Fill in the data for provided columns for column_name, values in rows_data.items(): col_index = column_name_to_index[column_name] if col_index < total_cols: new_row[col_index] = values[row_idx] - - new_rows.append(new_row) + new_rows.append(new_row) # Calculate where to start writing the new rows if available_empty_rows > 0: @@ -3978,7 +3950,10 @@ def append_table_rows( if new_rows: self.update(new_rows, f"{range_start_write}:{range_end_write}") - return {"status": "completed", "message": f"Successfully appended {num_rows_to_add} rows to table '{table_name}'"} + return { + "status": "completed", + "message": f"Successfully appended {num_rows_to_add} rows to table '{table_name}'", + } def update_table_rows( self, @@ -4082,7 +4057,9 @@ def update_table_rows( for col in all_columns: if col not in column_name_to_index: - raise GSpreadException(f"Column '{col}' not found in table '{table_name}'") + raise GSpreadException( + f"Column '{col}' not found in table '{table_name}'" + ) # Find matching rows matching_row_indices = [] @@ -4102,7 +4079,9 @@ def update_table_rows( cell_value = row[col_index] if col_index < len(row) else "" # Check if cell value matches any of the provided values for this column - if str(cell_value).strip() in [str(v).strip() for v in match_values]: + if str(cell_value).strip() in [ + str(v).strip() for v in match_values + ]: matching_columns += 1 # For OR logic, one match is enough @@ -4118,23 +4097,28 @@ def update_table_rows( matching_row_indices.append(row_idx) if not matching_row_indices: - return {"status": "completed", "message": f"No rows matched the specified conditions in table '{table_name}'", "rows_updated": 0} + return { + "status": "completed", + "message": f"No rows matched the specified conditions in table '{table_name}'", + "rows_updated": 0, + } # Prepare updates for matching rows updates = [] for row_idx in matching_row_indices: for col_name, new_value in columns_to_modify.items(): col_index = column_name_to_index[col_name] - actual_row = start_row + 1 + row_idx # +1 for header, +row_idx for data row + actual_row = ( + start_row + 1 + row_idx + ) # +1 for header, +row_idx for data row actual_col = start_col + col_index # Create A1 notation for the cell - cell_range = rowcol_to_a1(actual_row + 1, actual_col + 1) # +1 for A1 conversion + cell_range = rowcol_to_a1( + actual_row + 1, actual_col + 1 + ) # +1 for A1 conversion - updates.append({ - 'range': cell_range, - 'values': [[new_value]] - }) + updates.append({"range": cell_range, "values": [[new_value]]}) # Apply all updates in a batch if updates: @@ -4143,5 +4127,5 @@ def update_table_rows( return { "status": "completed", "message": f"Successfully updated {len(matching_row_indices)} rows in table '{table_name}'", - "rows_updated": len(matching_row_indices) - } \ No newline at end of file + "rows_updated": len(matching_row_indices), + } diff --git a/tests/cassettes/WorksheetTest.test_append_table_rows_basic.json b/tests/cassettes/WorksheetTest.test_append_table_rows_basic.json new file mode 100644 index 000000000..d1a030819 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_append_table_rows_basic.json @@ -0,0 +1,886 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_append_table_rows_basic\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "114" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:12 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "content-length": [ + "201" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"name\": \"Test WorksheetTest test_append_table_rows_basic\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:13 GMT" + ], + "content-length": [ + "3345" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_append_table_rows_basic\",\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/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:13 GMT" + ], + "content-length": [ + "3345" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_append_table_rows_basic\",\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/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:14 GMT" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/values/%27Sheet1%27%21A1%3AC3?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Age\", \"City\"], [\"Alice\", 25, \"New York\"], [\"Bob\", 30, \"San Francisco\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "118" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:14 GMT" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"updatedRange\": \"Sheet1!A1:C3\",\n \"updatedRows\": 3,\n \"updatedColumns\": 3,\n \"updatedCells\": 9\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"TestTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:14 GMT" + ], + "content-length": [ + "1303" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"862696839\",\n \"name\": \"TestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:15 GMT" + ], + "content-length": [ + "5895" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_append_table_rows_basic\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 862696839,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"862696839\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"862696839\",\n \"name\": \"TestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/values/%27Sheet1%27%21A1%3AC3", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:15 GMT" + ], + "content-length": [ + "246" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C3\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\"\n ],\n [\n \"Bob\",\n \"30\",\n \"San Francisco\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8:batchUpdate", + "body": "{\"requests\": [{\"updateTable\": {\"table\": {\"tableId\": \"862696839\", \"range\": {\"sheetId\": 0, \"startRowIndex\": 0, \"endRowIndex\": 5, \"startColumnIndex\": 0, \"endColumnIndex\": 3}}, \"fields\": \"range\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "194" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:16 GMT" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/values/%27Sheet1%27%21A4%3AC5?valueInputOption=RAW", + "body": "{\"values\": [[\"Charlie\", 35, \"Boston\"], [\"Diana\", 28, \"Seattle\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "89" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:16 GMT" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8\",\n \"updatedRange\": \"Sheet1!A4:C5\",\n \"updatedRows\": 2,\n \"updatedColumns\": 3,\n \"updatedCells\": 6\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8/values/%27Sheet1%27%21A1%3AC5", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:16 GMT" + ], + "content-length": [ + "359" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C5\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\"\n ],\n [\n \"Bob\",\n \"30\",\n \"San Francisco\"\n ],\n [\n \"Charlie\",\n \"35\",\n \"Boston\"\n ],\n [\n \"Diana\",\n \"28\",\n \"Seattle\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1v6vULTKuCa4f9G0DTJXBtiuGLqVXjyGgzA74SIOAgN8?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Content-Type": [ + "text/html" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:47:17 GMT" + ], + "Content-Length": [ + "0" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_append_table_rows_partial_columns.json b/tests/cassettes/WorksheetTest.test_append_table_rows_partial_columns.json new file mode 100644 index 000000000..2941df52f --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_append_table_rows_partial_columns.json @@ -0,0 +1,886 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_append_table_rows_partial_columns\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "124" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:15 GMT" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "content-length": [ + "211" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"name\": \"Test WorksheetTest test_append_table_rows_partial_columns\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3355" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_append_table_rows_partial_columns\",\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/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3355" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_append_table_rows_partial_columns\",\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/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:17 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/values/%27Sheet1%27%21A1%3AD2?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Age\", \"City\", \"Country\"], [\"Alice\", 25, \"New York\", \"USA\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:17 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"updatedRange\": \"Sheet1!A1:D2\",\n \"updatedRows\": 2,\n \"updatedColumns\": 4,\n \"updatedCells\": 8\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 2, \"startColumnIndex\": 0, \"endColumnIndex\": 4, \"sheetId\": 0}, \"name\": \"PartialTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:18 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "1406" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"2134827639\",\n \"name\": \"PartialTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 2,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Country\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:18 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "6010" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_append_table_rows_partial_columns\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 2134827639,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 2,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"2134827639\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"2134827639\",\n \"name\": \"PartialTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 2,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Country\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/values/%27Sheet1%27%21A1%3AD2", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:19 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "216" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D2\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\",\n \"Country\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\",\n \"USA\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4:batchUpdate", + "body": "{\"requests\": [{\"updateTable\": {\"table\": {\"tableId\": \"2134827639\", \"range\": {\"sheetId\": 0, \"startRowIndex\": 0, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 4}}, \"fields\": \"range\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "195" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:19 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/values/%27Sheet1%27%21A3%3AD4?valueInputOption=RAW", + "body": "{\"values\": [[\"Bob\", \"\", \"Boston\", \"\"], [\"Charlie\", \"\", \"Chicago\", \"\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "95" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:19 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4\",\n \"updatedRange\": \"Sheet1!A3:D4\",\n \"updatedRows\": 2,\n \"updatedColumns\": 4,\n \"updatedCells\": 8\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4/values/%27Sheet1%27%21A1%3AD4", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:20 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "323" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D4\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\",\n \"Country\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\",\n \"USA\"\n ],\n [\n \"Bob\",\n \"\",\n \"Boston\"\n ],\n [\n \"Charlie\",\n \"\",\n \"Chicago\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1z4qXyIkG8-dEeKwtDQ6qc59fSR7R62fHwSkheT_6pI4?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Content-Length": [ + "0" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Content-Type": [ + "text/html" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Sat, 13 Dec 2025 00:48:20 GMT" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_create_table_basic.json b/tests/cassettes/WorksheetTest.test_create_table_basic.json new file mode 100644 index 000000000..e286c6135 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_create_table_basic.json @@ -0,0 +1,524 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_create_table_basic\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "109" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:27 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "196" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0\",\n \"name\": \"Test WorksheetTest test_create_table_basic\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:28 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3340" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_create_table_basic\",\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/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:29 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3340" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_create_table_basic\",\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/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:29 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0/values/%27Sheet1%27%21A1%3AC3?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Age\", \"City\"], [\"Alice\", 25, \"New York\"], [\"Bob\", 30, \"San Francisco\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "118" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:29 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0\",\n \"updatedRange\": \"Sheet1!A1:C3\",\n \"updatedRows\": 3,\n \"updatedColumns\": 3,\n \"updatedCells\": 9\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"TestTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:30 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "1303" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"936817549\",\n \"name\": \"TestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1Vnom_4FiunsKksQlVmoEVBPu8z75e7i6OUcvAx5CxX0?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Content-Type": [ + "text/html" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:30 GMT" + ], + "Content-Length": [ + "0" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Server": [ + "ESF" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_create_table_minimal.json b/tests/cassettes/WorksheetTest.test_create_table_minimal.json new file mode 100644 index 000000000..ff3d6dee8 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_create_table_minimal.json @@ -0,0 +1,524 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_create_table_minimal\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "111" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:32 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "198" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk\",\n \"name\": \"Test WorksheetTest test_create_table_minimal\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:32 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3342" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_create_table_minimal\",\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/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:33 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3342" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_create_table_minimal\",\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/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:33 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk/values/%27Sheet1%27%21A1%3AB2?valueInputOption=RAW", + "body": "{\"values\": [[\"Data1\", \"Data2\"], [\"Value1\", \"Value2\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "78" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:34 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk\",\n \"updatedRange\": \"Sheet1!A1:B2\",\n \"updatedRows\": 2,\n \"updatedColumns\": 2,\n \"updatedCells\": 4\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 2, \"startColumnIndex\": 0, \"endColumnIndex\": 2, \"sheetId\": 0}}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "148" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:34 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "1207" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"992657031\",\n \"name\": \"Table1\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 2,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 2\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Data1\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Data2\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/10-IrrDIU-NRQh12ofQIevNk2bzYu83so224pGiCXHtk?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Content-Type": [ + "text/html" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:35 GMT" + ], + "Content-Length": [ + "0" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Server": [ + "ESF" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_create_table_with_column_names.json b/tests/cassettes/WorksheetTest.test_create_table_with_column_names.json new file mode 100644 index 000000000..aad4a07f4 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_create_table_with_column_names.json @@ -0,0 +1,600 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_create_table_with_column_names\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "121" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:36 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "208" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"name\": \"Test WorksheetTest test_create_table_with_column_names\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:37 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3352" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_create_table_with_column_names\",\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/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:37 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3352" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_create_table_with_column_names\",\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/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:37 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY/values/%27Sheet1%27%21A1%3AC2?valueInputOption=RAW", + "body": "{\"values\": [[\"Alice\", 25, \"New York\"], [\"Bob\", 30, \"San Francisco\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "93" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:38 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "168" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"updatedRange\": \"Sheet1!A1:C2\",\n \"updatedRows\": 2,\n \"updatedColumns\": 3,\n \"updatedCells\": 6\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 2, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"TableWithExplicitColumns\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "184" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:38 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "1321" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"40824474\",\n \"name\": \"TableWithExplicitColumns\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 2,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Alice\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"25\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"New York\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY:batchUpdate", + "body": "{\"requests\": [{\"updateTable\": {\"table\": {\"tableId\": \"40824474\", \"columnProperties\": [{\"columnIndex\": 0, \"columnName\": \"Name\"}, {\"columnIndex\": 1, \"columnName\": \"Age\"}, {\"columnIndex\": 2, \"columnName\": \"City\"}]}, \"fields\": \"columnProperties\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "244" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:38 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1GXlmS_2r66kZlKIUlgfNJ-iAsxXlb-8VgI5FpTawCSY?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Content-Type": [ + "text/html" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "Date": [ + "Sat, 13 Dec 2025 00:44:39 GMT" + ], + "Content-Length": [ + "0" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Server": [ + "ESF" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_delete_table_row_basic.json b/tests/cassettes/WorksheetTest.test_delete_table_row_basic.json new file mode 100644 index 000000000..a99f5ccf6 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_delete_table_row_basic.json @@ -0,0 +1,962 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_delete_table_row_basic\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "113" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Sat, 13 Dec 2025 00:49:42 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin, X-Origin" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "200" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"name\": \"Test WorksheetTest test_delete_table_row_basic\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:43 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3344" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_basic\",\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/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:43 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "3344" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_basic\",\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/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:44 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/values/%27Sheet1%27%21A1%3AC5?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Age\", \"City\"], [\"Alice\", 25, \"New York\"], [\"Bob\", 30, \"San Francisco\"], [\"Charlie\", 35, \"Boston\"], [\"Diana\", 28, \"Seattle\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "171" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:44 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"updatedRange\": \"Sheet1!A1:C5\",\n \"updatedRows\": 5,\n \"updatedColumns\": 3,\n \"updatedCells\": 15\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 5, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"DeleteTestTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "175" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:45 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "1310" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"1459664428\",\n \"name\": \"DeleteTestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:46 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "5903" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_basic\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 1459664428,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"1459664428\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"1459664428\",\n \"name\": \"DeleteTestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/values/%27Sheet1%27%21A1%3AC5", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:46 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "359" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C5\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\"\n ],\n [\n \"Bob\",\n \"30\",\n \"San Francisco\"\n ],\n [\n \"Charlie\",\n \"35\",\n \"Boston\"\n ],\n [\n \"Diana\",\n \"28\",\n \"Seattle\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE:batchUpdate", + "body": "{\"requests\": [{\"copyPaste\": {\"source\": {\"sheetId\": 0, \"startRowIndex\": 3, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"destination\": {\"sheetId\": 0, \"startRowIndex\": 2, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"pasteType\": \"PASTE_VALUES\"}}, {\"copyPaste\": {\"source\": {\"sheetId\": 0, \"startRowIndex\": 4, \"endRowIndex\": 5, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"destination\": {\"sheetId\": 0, \"startRowIndex\": 3, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"pasteType\": \"PASTE_VALUES\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "548" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:47 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "105" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"replies\": [\n {},\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/values:batchClear", + "body": "{\"ranges\": [\"'Sheet1'!A5:C5\"]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "30" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:47 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "115" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"clearedRanges\": [\n \"Sheet1!A5:C5\"\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE:batchUpdate", + "body": "{\"requests\": [{\"updateTable\": {\"table\": {\"tableId\": \"1459664428\", \"range\": {\"sheetId\": 0, \"startRowIndex\": 0, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3}}, \"fields\": \"range\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "195" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:48 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE/values/%27Sheet1%27%21A1%3AC4", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Date": [ + "Sat, 13 Dec 2025 00:49:48 GMT" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "content-length": [ + "299" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C4\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\"\n ],\n [\n \"Charlie\",\n \"35\",\n \"Boston\"\n ],\n [\n \"Diana\",\n \"28\",\n \"Seattle\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1spo2rdKOXlJZpYCLm-KqAEdkUB1Z_DfclE8YLSVBdhE?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Sat, 13 Dec 2025 00:49:49 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Vary": [ + "Origin, X-Origin" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "text/html" + ], + "X-XSS-Protection": [ + "0" + ], + "Content-Length": [ + "0" + ], + "Server": [ + "ESF" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_delete_table_row_first_and_last.json b/tests/cassettes/WorksheetTest.test_delete_table_row_first_and_last.json new file mode 100644 index 000000000..bd4cac68d --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_delete_table_row_first_and_last.json @@ -0,0 +1,1324 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_delete_table_row_first_and_last\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "122" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Pragma": [ + "no-cache" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:21 GMT" + ], + "content-length": [ + "209" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"name\": \"Test WorksheetTest test_delete_table_row_first_and_last\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:22 GMT" + ], + "content-length": [ + "3353" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_first_and_last\",\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/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:22 GMT" + ], + "content-length": [ + "3353" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_first_and_last\",\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/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:23 GMT" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values/%27Sheet1%27%21A1%3AC4?valueInputOption=RAW", + "body": "{\"values\": [[\"Product\", \"Sales\", \"Region\"], [\"Widget A\", 100, \"North\"], [\"Widget B\", 150, \"South\"], [\"Widget C\", 200, \"East\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "151" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:24 GMT" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"updatedRange\": \"Sheet1!A1:C4\",\n \"updatedRows\": 4,\n \"updatedColumns\": 3,\n \"updatedCells\": 12\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"RowDeleteTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "174" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:24 GMT" + ], + "content-length": [ + "1315" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"644887690\",\n \"name\": \"RowDeleteTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Product\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Sales\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Region\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:25 GMT" + ], + "content-length": [ + "5915" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_first_and_last\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 644887690,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"644887690\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"644887690\",\n \"name\": \"RowDeleteTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Product\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Sales\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Region\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values/%27Sheet1%27%21A1%3AC4", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:25 GMT" + ], + "content-length": [ + "309" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C4\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Product\",\n \"Sales\",\n \"Region\"\n ],\n [\n \"Widget A\",\n \"100\",\n \"North\"\n ],\n [\n \"Widget B\",\n \"150\",\n \"South\"\n ],\n [\n \"Widget C\",\n \"200\",\n \"East\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY:batchUpdate", + "body": "{\"requests\": [{\"copyPaste\": {\"source\": {\"sheetId\": 0, \"startRowIndex\": 2, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"destination\": {\"sheetId\": 0, \"startRowIndex\": 1, \"endRowIndex\": 2, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"pasteType\": \"PASTE_VALUES\"}}, {\"copyPaste\": {\"source\": {\"sheetId\": 0, \"startRowIndex\": 3, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"destination\": {\"sheetId\": 0, \"startRowIndex\": 2, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 3}, \"pasteType\": \"PASTE_VALUES\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "548" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:26 GMT" + ], + "content-length": [ + "105" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"replies\": [\n {},\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values:batchClear", + "body": "{\"ranges\": [\"'Sheet1'!A4:C4\"]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "30" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:26 GMT" + ], + "content-length": [ + "115" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"clearedRanges\": [\n \"Sheet1!A4:C4\"\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY:batchUpdate", + "body": "{\"requests\": [{\"updateTable\": {\"table\": {\"tableId\": \"644887690\", \"range\": {\"sheetId\": 0, \"startRowIndex\": 0, \"endRowIndex\": 3, \"startColumnIndex\": 0, \"endColumnIndex\": 3}}, \"fields\": \"range\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "194" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:27 GMT" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values/%27Sheet1%27%21A1%3AC3", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:27 GMT" + ], + "content-length": [ + "251" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C3\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Product\",\n \"Sales\",\n \"Region\"\n ],\n [\n \"Widget B\",\n \"150\",\n \"South\"\n ],\n [\n \"Widget C\",\n \"200\",\n \"East\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:27 GMT" + ], + "content-length": [ + "5915" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_delete_table_row_first_and_last\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 644887690,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"644887690\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"644887690\",\n \"name\": \"RowDeleteTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 3,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Product\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Sales\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Region\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values/%27Sheet1%27%21A1%3AC3", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:28 GMT" + ], + "content-length": [ + "251" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C3\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Product\",\n \"Sales\",\n \"Region\"\n ],\n [\n \"Widget B\",\n \"150\",\n \"South\"\n ],\n [\n \"Widget C\",\n \"200\",\n \"East\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values:batchClear", + "body": "{\"ranges\": [\"'Sheet1'!A3:C3\"]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "30" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:28 GMT" + ], + "content-length": [ + "115" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"clearedRanges\": [\n \"Sheet1!A3:C3\"\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY:batchUpdate", + "body": "{\"requests\": [{\"updateTable\": {\"table\": {\"tableId\": \"644887690\", \"range\": {\"sheetId\": 0, \"startRowIndex\": 0, \"endRowIndex\": 2, \"startColumnIndex\": 0, \"endColumnIndex\": 3}}, \"fields\": \"range\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "194" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:29 GMT" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY/values/%27Sheet1%27%21A1%3AC2", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:29 GMT" + ], + "content-length": [ + "194" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C2\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Product\",\n \"Sales\",\n \"Region\"\n ],\n [\n \"Widget B\",\n \"150\",\n \"South\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1LABtMuzstz8YjU8mysQqn9pFsV0VJpclBrsA9Puc4PY?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Content-Type": [ + "text/html" + ], + "Server": [ + "ESF" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Vary": [ + "Origin, X-Origin" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Pragma": [ + "no-cache" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Content-Length": [ + "0" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:51:29 GMT" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_and_logic.json b/tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_and_logic.json new file mode 100644 index 000000000..f2fcb59a0 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_and_logic.json @@ -0,0 +1,810 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_update_table_rows_multiple_match_and_logic\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "133" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin, X-Origin" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:14 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "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" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "220" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"name\": \"Test WorksheetTest test_update_table_rows_multiple_match_and_logic\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:15 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3364" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_multiple_match_and_logic\",\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/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:15 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3364" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_multiple_match_and_logic\",\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/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/values/%27Sheet1%27%21A1%3AD5?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Status\", \"Age\", \"Department\"], [\"Alice\", \"Active\", 25, \"Engineering\"], [\"Bob\", \"Active\", 30, \"Sales\"], [\"Charlie\", \"Inactive\", 35, \"Engineering\"], [\"Diana\", \"Active\", 28, \"Engineering\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "233" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:16 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"updatedRange\": \"Sheet1!A1:D5\",\n \"updatedRows\": 5,\n \"updatedColumns\": 4,\n \"updatedCells\": 20\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 5, \"startColumnIndex\": 0, \"endColumnIndex\": 4, \"sheetId\": 0}, \"name\": \"AndLogicTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "173" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:17 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "1411" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"405934986\",\n \"name\": \"AndLogicTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Status\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Department\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:17 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "6022" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_multiple_match_and_logic\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 405934986,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"405934986\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"405934986\",\n \"name\": \"AndLogicTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Status\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Department\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/values/%27Sheet1%27%21A1%3AD5", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:17 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "451" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D5\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Status\",\n \"Age\",\n \"Department\"\n ],\n [\n \"Alice\",\n \"Active\",\n \"25\",\n \"Engineering\"\n ],\n [\n \"Bob\",\n \"Active\",\n \"30\",\n \"Sales\"\n ],\n [\n \"Charlie\",\n \"Inactive\",\n \"35\",\n \"Engineering\"\n ],\n [\n \"Diana\",\n \"Active\",\n \"28\",\n \"Engineering\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/values:batchUpdate", + "body": "{\"valueInputOption\": \"RAW\", \"includeValuesInResponse\": null, \"responseValueRenderOption\": null, \"responseDateTimeRenderOption\": null, \"data\": [{\"range\": \"'Sheet1'!B2\", \"values\": [[\"Active - Eng\"]]}, {\"range\": \"'Sheet1'!C2\", \"values\": [[\"Updated\"]]}, {\"range\": \"'Sheet1'!B5\", \"values\": [[\"Active - Eng\"]]}, {\"range\": \"'Sheet1'!C5\", \"values\": [[\"Updated\"]]}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "357" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:18 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "973" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"totalUpdatedRows\": 2,\n \"totalUpdatedColumns\": 2,\n \"totalUpdatedCells\": 4,\n \"totalUpdatedSheets\": 1,\n \"responses\": [\n {\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"updatedRange\": \"Sheet1!B2\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"updatedRange\": \"Sheet1!C2\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"updatedRange\": \"Sheet1!B5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4\",\n \"updatedRange\": \"Sheet1!C5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4/values/%27Sheet1%27%21A1%3AD5", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Transfer-Encoding": [ + "chunked" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:18 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "473" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D5\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Status\",\n \"Age\",\n \"Department\"\n ],\n [\n \"Alice\",\n \"Active - Eng\",\n \"Updated\",\n \"Engineering\"\n ],\n [\n \"Bob\",\n \"Active\",\n \"30\",\n \"Sales\"\n ],\n [\n \"Charlie\",\n \"Inactive\",\n \"35\",\n \"Engineering\"\n ],\n [\n \"Diana\",\n \"Active - Eng\",\n \"Updated\",\n \"Engineering\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1eqjmo4Yn9FX9TaRJ4yjrSz7PA6DgECGTHLgtc47FFY4?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Vary": [ + "Origin, X-Origin" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Date": [ + "Sat, 13 Dec 2025 01:00:19 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "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" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "0" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_or_logic.json b/tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_or_logic.json new file mode 100644 index 000000000..f5d619b27 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_update_table_rows_multiple_match_or_logic.json @@ -0,0 +1,810 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_update_table_rows_multiple_match_or_logic\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "132" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:13 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "219" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"name\": \"Test WorksheetTest test_update_table_rows_multiple_match_or_logic\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:14 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "3363" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_multiple_match_or_logic\",\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/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:14 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "3363" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_multiple_match_or_logic\",\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/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:15 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/values/%27Sheet1%27%21A1%3AD6?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Status\", \"Age\", \"Priority\"], [\"Alice\", \"Active\", 25, \"High\"], [\"Bob\", \"Inactive\", 30, \"Low\"], [\"Charlie\", \"Active\", 35, \"Medium\"], [\"Diana\", \"Pending\", 28, \"High\"], [\"Eve\", \"Inactive\", 32, \"Critical\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "248" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:15 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!A1:D6\",\n \"updatedRows\": 6,\n \"updatedColumns\": 4,\n \"updatedCells\": 24\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 6, \"startColumnIndex\": 0, \"endColumnIndex\": 4, \"sheetId\": 0}, \"name\": \"OrLogicTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:16 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "1409" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"1830274244\",\n \"name\": \"OrLogicTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 6,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Status\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Priority\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:16 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "6021" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_multiple_match_or_logic\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 1830274244,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 6,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"1830274244\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"1830274244\",\n \"name\": \"OrLogicTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 6,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Status\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Priority\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/values/%27Sheet1%27%21A1%3AD6", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:17 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "502" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D6\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Status\",\n \"Age\",\n \"Priority\"\n ],\n [\n \"Alice\",\n \"Active\",\n \"25\",\n \"High\"\n ],\n [\n \"Bob\",\n \"Inactive\",\n \"30\",\n \"Low\"\n ],\n [\n \"Charlie\",\n \"Active\",\n \"35\",\n \"Medium\"\n ],\n [\n \"Diana\",\n \"Pending\",\n \"28\",\n \"High\"\n ],\n [\n \"Eve\",\n \"Inactive\",\n \"32\",\n \"Critical\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/values:batchUpdate", + "body": "{\"valueInputOption\": \"RAW\", \"includeValuesInResponse\": null, \"responseValueRenderOption\": null, \"responseDateTimeRenderOption\": null, \"data\": [{\"range\": \"'Sheet1'!B2\", \"values\": [[\"Reviewed\"]]}, {\"range\": \"'Sheet1'!D2\", \"values\": [[\"Updated\"]]}, {\"range\": \"'Sheet1'!B3\", \"values\": [[\"Reviewed\"]]}, {\"range\": \"'Sheet1'!D3\", \"values\": [[\"Updated\"]]}, {\"range\": \"'Sheet1'!B5\", \"values\": [[\"Reviewed\"]]}, {\"range\": \"'Sheet1'!D5\", \"values\": [[\"Updated\"]]}, {\"range\": \"'Sheet1'!B6\", \"values\": [[\"Reviewed\"]]}, {\"range\": \"'Sheet1'!D6\", \"values\": [[\"Updated\"]]}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "555" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:17 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "1749" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"totalUpdatedRows\": 4,\n \"totalUpdatedColumns\": 2,\n \"totalUpdatedCells\": 8,\n \"totalUpdatedSheets\": 1,\n \"responses\": [\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!B2\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!D2\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!B3\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!D3\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!B5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!B6\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU\",\n \"updatedRange\": \"Sheet1!D6\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU/values/%27Sheet1%27%21A1%3AD6", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:17 GMT" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "content-length": [ + "514" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D6\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Status\",\n \"Age\",\n \"Priority\"\n ],\n [\n \"Alice\",\n \"Reviewed\",\n \"25\",\n \"Updated\"\n ],\n [\n \"Bob\",\n \"Reviewed\",\n \"30\",\n \"Updated\"\n ],\n [\n \"Charlie\",\n \"Active\",\n \"35\",\n \"Medium\"\n ],\n [\n \"Diana\",\n \"Reviewed\",\n \"28\",\n \"Updated\"\n ],\n [\n \"Eve\",\n \"Reviewed\",\n \"32\",\n \"Updated\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1IfVUHayaOgL5pjKJ1YGFdLvB9mRurFTku1KTjM-vfKU?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Sat, 13 Dec 2025 00:58:18 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-XSS-Protection": [ + "0" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Content-Type": [ + "text/html" + ], + "Server": [ + "ESF" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Content-Length": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_update_table_rows_single_match.json b/tests/cassettes/WorksheetTest.test_update_table_rows_single_match.json new file mode 100644 index 000000000..1d244dd7e --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_update_table_rows_single_match.json @@ -0,0 +1,810 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_update_table_rows_single_match\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "121" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "ESF" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:14 GMT" + ], + "content-length": [ + "208" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"name\": \"Test WorksheetTest test_update_table_rows_single_match\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:14 GMT" + ], + "content-length": [ + "3352" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_single_match\",\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/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:15 GMT" + ], + "content-length": [ + "3352" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_single_match\",\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/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:15 GMT" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/values/%27Sheet1%27%21A1%3AD5?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Status\", \"Age\", \"Department\"], [\"Alice\", \"Active\", 25, \"Engineering\"], [\"Bob\", \"Inactive\", 30, \"Sales\"], [\"Charlie\", \"Active\", 35, \"Engineering\"], [\"Diana\", \"Pending\", 28, \"Marketing\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "232" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:15 GMT" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"updatedRange\": \"Sheet1!A1:D5\",\n \"updatedRows\": 5,\n \"updatedColumns\": 4,\n \"updatedCells\": 20\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 5, \"startColumnIndex\": 0, \"endColumnIndex\": 4, \"sheetId\": 0}, \"name\": \"UpdateTestTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "175" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:16 GMT" + ], + "content-length": [ + "1413" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"256784322\",\n \"name\": \"UpdateTestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Status\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Department\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:16 GMT" + ], + "content-length": [ + "6012" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_table_rows_single_match\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 256784322,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"256784322\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"256784322\",\n \"name\": \"UpdateTestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 5,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 4\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Status\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 3,\n \"columnName\": \"Department\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/values/%27Sheet1%27%21A1%3AD5", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:16 GMT" + ], + "content-length": [ + "450" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D5\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Status\",\n \"Age\",\n \"Department\"\n ],\n [\n \"Alice\",\n \"Active\",\n \"25\",\n \"Engineering\"\n ],\n [\n \"Bob\",\n \"Inactive\",\n \"30\",\n \"Sales\"\n ],\n [\n \"Charlie\",\n \"Active\",\n \"35\",\n \"Engineering\"\n ],\n [\n \"Diana\",\n \"Pending\",\n \"28\",\n \"Marketing\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/values:batchUpdate", + "body": "{\"valueInputOption\": \"RAW\", \"includeValuesInResponse\": null, \"responseValueRenderOption\": null, \"responseDateTimeRenderOption\": null, \"data\": [{\"range\": \"'Sheet1'!B2\", \"values\": [[\"Current\"]]}, {\"range\": \"'Sheet1'!D2\", \"values\": [[\"Engineering - Updated\"]]}, {\"range\": \"'Sheet1'!B4\", \"values\": [[\"Current\"]]}, {\"range\": \"'Sheet1'!D4\", \"values\": [[\"Engineering - Updated\"]]}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "375" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:16 GMT" + ], + "content-length": [ + "973" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"totalUpdatedRows\": 2,\n \"totalUpdatedColumns\": 2,\n \"totalUpdatedCells\": 4,\n \"totalUpdatedSheets\": 1,\n \"responses\": [\n {\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"updatedRange\": \"Sheet1!B2\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"updatedRange\": \"Sheet1!D2\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"updatedRange\": \"Sheet1!B4\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n },\n {\n \"spreadsheetId\": \"1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM\",\n \"updatedRange\": \"Sheet1!D4\",\n \"updatedRows\": 1,\n \"updatedColumns\": 1,\n \"updatedCells\": 1\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM/values/%27Sheet1%27%21A1%3AD5", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Server": [ + "ESF" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:17 GMT" + ], + "content-length": [ + "472" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:D5\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Status\",\n \"Age\",\n \"Department\"\n ],\n [\n \"Alice\",\n \"Current\",\n \"25\",\n \"Engineering - Updated\"\n ],\n [\n \"Bob\",\n \"Inactive\",\n \"30\",\n \"Sales\"\n ],\n [\n \"Charlie\",\n \"Current\",\n \"35\",\n \"Engineering - Updated\"\n ],\n [\n \"Diana\",\n \"Pending\",\n \"28\",\n \"Marketing\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1F8mCn1Nk-smEElYTIaIYU5MCmyjpD8opAJ5_-YZ0ACM?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "X-XSS-Protection": [ + "0" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "ESF" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Type": [ + "text/html" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Content-Length": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Date": [ + "Sat, 13 Dec 2025 00:54:18 GMT" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/conftest.py b/tests/conftest.py index 82f17da48..ac7c1c779 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,6 +17,7 @@ from gspread.http_client import BackOffHTTPClient CREDS_FILENAME = os.getenv("GS_CREDS_FILENAME") +CREDS_OAUTH_FILENAME = os.getenv("GS_CREDS_OAUTH_FILENAME") RECORD_MODE = os.getenv("GS_RECORD_MODE", "none") SCOPE = [ @@ -32,6 +33,11 @@ def read_credentials(filename: str) -> Credentials: return ServiceAccountCredentials.from_service_account_file(filename, scopes=SCOPE) +def read_oauth_credentials(filename: str) -> Client: + """Read OAuth credentials and return authenticated client.""" + return gspread.oauth(credentials_filename=filename) + + def prefixed_counter(prefix: str, start: int = 1) -> Generator[str, None, None]: c = itertools.count(start) for value in c: @@ -130,12 +136,16 @@ def request(self, *args: Any, **kwargs: Any) -> Response: @pytest.fixture(scope="module") def client() -> Client: - if CREDS_FILENAME is not None: + # Try OAuth credentials first, then fall back to service account + if CREDS_OAUTH_FILENAME is not None: + gc = read_oauth_credentials(CREDS_OAUTH_FILENAME) + elif CREDS_FILENAME is not None: auth_credentials = read_credentials(CREDS_FILENAME) + gc = Client(auth=auth_credentials, http_client=VCRHTTPClient) else: auth_credentials = DummyCredentials(DUMMY_ACCESS_TOKEN) + gc = Client(auth=auth_credentials, http_client=VCRHTTPClient) - gc = Client(auth=auth_credentials, http_client=VCRHTTPClient) if not isinstance(gc, gspread.client.Client) is True: raise AssertionError diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index f8523b5bd..32ab85942 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -2007,3 +2007,353 @@ def test_add_validation(self): # Further ensure we are able to access the exception's properties after pickling reloaded_exception = pickle.loads(pickle.dumps(ex.exception)) # nosec self.assertEqual(reloaded_exception.args[0]["status"], "INVALID_ARGUMENT") + + @pytest.mark.vcr() + def test_create_table_basic(self): + """Test basic table creation with headers.""" + # First, add some data to the worksheet + self.sheet.update( + [ + ["Name", "Age", "City"], + ["Alice", 25, "New York"], + ["Bob", 30, "San Francisco"], + ], + "A1:C3", + ) + + # Create a table on the existing data + table = self.sheet.create_table(range_name="A1:C3", table_name="TestTable") + + # Verify table was created + self.assertIsNotNone(table) + + # The actual table info is nested in the response + table_info = table["replies"][0]["addTable"]["table"] + + # Verify table name + self.assertEqual(table_info["name"], "TestTable") + + # Verify column names (they're in columnProperties) + column_names = [col["columnName"] for col in table_info["columnProperties"]] + self.assertEqual(column_names, ["Name", "Age", "City"]) + + @pytest.mark.vcr() + def test_create_table_with_column_names(self): + """Test table creation with explicit column names.""" + # Add data without headers first + self.sheet.update( + [["Alice", 25, "New York"], ["Bob", 30, "San Francisco"]], "A1:C2" + ) + + # Create table with explicit column names + table = self.sheet.create_table( + range_name="A1:C2", + table_name="TableWithExplicitColumns", + column_names=["Name", "Age", "City"], + ) + + # Verify table was created + self.assertIsNotNone(table) + + # Check what's actually in the response + if ( + "replies" in table + and len(table["replies"]) > 0 + and "addTable" in table["replies"][0] + ): + table_info = table["replies"][0]["addTable"]["table"] + self.assertEqual(table_info["name"], "TableWithExplicitColumns") + # Verify column names + column_names = [col["columnName"] for col in table_info["columnProperties"]] + self.assertEqual(column_names, ["Name", "Age", "City"]) + else: + # The response structure might be different when using column_names + # For now, just verify the table was created successfully + self.assertIsNotNone(table) + + @pytest.mark.vcr() + def test_create_table_minimal(self): + """Test table creation with minimal parameters.""" + # Add some data + self.sheet.update([["Data1", "Data2"], ["Value1", "Value2"]], "A1:B2") + + # Create table with just range name + table = self.sheet.create_table(range_name="A1:B2") + + # Verify table was created (Google Sheets generates a default name) + self.assertIsNotNone(table) + table_info = table["replies"][0]["addTable"]["table"] + self.assertIn("name", table_info) + self.assertEqual(len(table_info["columnProperties"]), 2) + + @pytest.mark.vcr() + def test_append_table_rows_basic(self): + """Test basic table row appending.""" + # First create a table with some initial data + self.sheet.update( + [ + ["Name", "Age", "City"], + ["Alice", 25, "New York"], + ["Bob", 30, "San Francisco"], + ], + "A1:C3", + ) + + self.sheet.create_table(range_name="A1:C3", table_name="TestTable") + + # Append new rows to the table + result = self.sheet.append_table_rows( + "TestTable", + { + "Name": ["Charlie", "Diana"], + "Age": [35, 28], + "City": ["Boston", "Seattle"], + }, + ) + + # Verify the append operation succeeded + self.assertIsNotNone(result) + + # Check that the new data was added + values = self.sheet.get_values("A1:C5") + expected = [ + ["Name", "Age", "City"], + ["Alice", "25", "New York"], # Original data + ["Bob", "30", "San Francisco"], # Original data + ["Charlie", "35", "Boston"], # New row 1 + ["Diana", "28", "Seattle"], # New row 2 + ] + self.assertEqual(values, expected) + + @pytest.mark.vcr() + def test_append_table_rows_partial_columns(self): + """Test appending rows with only some columns.""" + # Create a table first + self.sheet.update( + [["Name", "Age", "City", "Country"], ["Alice", 25, "New York", "USA"]], + "A1:D2", + ) + + self.sheet.create_table(range_name="A1:D2", table_name="PartialTable") + + # Append rows with only some columns (Name and City) + result = self.sheet.append_table_rows( + "PartialTable", {"Name": ["Bob", "Charlie"], "City": ["Boston", "Chicago"]} + ) + + # Verify the append operation succeeded + self.assertIsNotNone(result) + + # Check that data was added correctly (Age and Country should be empty) + values = self.sheet.get_values("A1:D4") + expected = [ + ["Name", "Age", "City", "Country"], + ["Alice", "25", "New York", "USA"], # Original data + ["Bob", "", "Boston", ""], # New row 1 (partial) + ["Charlie", "", "Chicago", ""], # New row 2 (partial) + ] + self.assertEqual(values, expected) + + @pytest.mark.vcr() + def test_delete_table_row_basic(self): + """Test basic table row deletion.""" + # Create a table with initial data + self.sheet.update( + [ + ["Name", "Age", "City"], + ["Alice", 25, "New York"], + ["Bob", 30, "San Francisco"], + ["Charlie", 35, "Boston"], + ["Diana", 28, "Seattle"], + ], + "A1:C5", + ) + + self.sheet.create_table(range_name="A1:C5", table_name="DeleteTestTable") + + # Delete the second data row (index 1 = "Bob") + result = self.sheet.delete_table_row("DeleteTestTable", 1) + + # Verify the delete operation succeeded + self.assertIsNotNone(result) + + # Check that the correct row was deleted + values = self.sheet.get_values("A1:C4") + expected = [ + ["Name", "Age", "City"], # Header + ["Alice", "25", "New York"], # First data row (index 0) + ["Charlie", "35", "Boston"], # Third data row (now index 1) + ["Diana", "28", "Seattle"], # Fourth data row (now index 2) + ] + self.assertEqual(values, expected) + + @pytest.mark.vcr() + def test_delete_table_row_first_and_last(self): + """Test deleting first and last data rows.""" + # Create a table with initial data + self.sheet.update( + [ + ["Product", "Sales", "Region"], + ["Widget A", 100, "North"], + ["Widget B", 150, "South"], + ["Widget C", 200, "East"], + ], + "A1:C4", + ) + + self.sheet.create_table(range_name="A1:C4", table_name="RowDeleteTable") + + # Delete the first data row (index 0 = "Widget A") + result1 = self.sheet.delete_table_row("RowDeleteTable", 0) + self.assertIsNotNone(result1) + + # Check first deletion + values1 = self.sheet.get_values("A1:C3") + expected1 = [ + ["Product", "Sales", "Region"], + ["Widget B", "150", "South"], # Now first data row + ["Widget C", "200", "East"], # Now second data row + ] + self.assertEqual(values1, expected1) + + # Delete the last data row (index 1 = "Widget C") + result2 = self.sheet.delete_table_row("RowDeleteTable", 1) + self.assertIsNotNone(result2) + + # Check second deletion + values2 = self.sheet.get_values("A1:C2") + expected2 = [ + ["Product", "Sales", "Region"], + ["Widget B", "150", "South"], # Only remaining data row + ] + self.assertEqual(values2, expected2) + + @pytest.mark.vcr() + def test_update_table_rows_single_match(self): + """Test updating table rows with single column matching (AND logic).""" + # Create a table with initial data + self.sheet.update( + [ + ["Name", "Status", "Age", "Department"], + ["Alice", "Active", 25, "Engineering"], + ["Bob", "Inactive", 30, "Sales"], + ["Charlie", "Active", 35, "Engineering"], + ["Diana", "Pending", 28, "Marketing"], + ], + "A1:D5", + ) + + self.sheet.create_table(range_name="A1:D5", table_name="UpdateTestTable") + + # Update all "Active" employees to "Current" and add a note + result = self.sheet.update_table_rows( + "UpdateTestTable", + columns_to_match={"Status": ["Active"]}, + columns_to_modify={ + "Status": "Current", + "Department": "Engineering - Updated", + }, + ) + + # Verify the update operation succeeded + self.assertIsNotNone(result) + + # Check that the correct rows were updated + values = self.sheet.get_values("A1:D5") + expected = [ + ["Name", "Status", "Age", "Department"], + ["Alice", "Current", "25", "Engineering - Updated"], # Updated + ["Bob", "Inactive", "30", "Sales"], # Not changed + ["Charlie", "Current", "35", "Engineering - Updated"], # Updated + ["Diana", "Pending", "28", "Marketing"], # Not changed + ] + self.assertEqual(values, expected) + + @pytest.mark.vcr() + def test_update_table_rows_multiple_match_or_logic(self): + """Test updating table rows with multiple column matching (OR logic).""" + # Create a table with initial data + self.sheet.update( + [ + ["Name", "Status", "Age", "Priority"], + ["Alice", "Active", 25, "High"], + ["Bob", "Inactive", 30, "Low"], + ["Charlie", "Active", 35, "Medium"], + ["Diana", "Pending", 28, "High"], + ["Eve", "Inactive", 32, "Critical"], + ], + "A1:D6", + ) + + self.sheet.create_table(range_name="A1:D6", table_name="OrLogicTable") + + # Update rows that are either "Inactive" OR have "High" priority (OR logic) + result = self.sheet.update_table_rows( + "OrLogicTable", + columns_to_match={"Status": ["Inactive"], "Priority": ["High"]}, + columns_to_modify={"Status": "Reviewed", "Priority": "Updated"}, + or_logical=True, + ) + + # Verify the update operation succeeded + self.assertIsNotNone(result) + + # Check that the correct rows were updated + values = self.sheet.get_values("A1:D6") + expected = [ + ["Name", "Status", "Age", "Priority"], + ["Alice", "Reviewed", "25", "Updated"], # High priority (matched) + ["Bob", "Reviewed", "30", "Updated"], # Inactive (matched) + ["Charlie", "Active", "35", "Medium"], # Not changed + ["Diana", "Reviewed", "28", "Updated"], # High priority (matched) + ["Eve", "Reviewed", "32", "Updated"], # Inactive (matched) + ] + self.assertEqual(values, expected) + + @pytest.mark.vcr() + def test_update_table_rows_multiple_match_and_logic(self): + """Test updating table rows with multiple column matching (AND logic).""" + # Create a table with initial data + self.sheet.update( + [ + ["Name", "Status", "Age", "Department"], + ["Alice", "Active", 25, "Engineering"], + ["Bob", "Active", 30, "Sales"], + ["Charlie", "Inactive", 35, "Engineering"], + ["Diana", "Active", 28, "Engineering"], + ], + "A1:D5", + ) + + self.sheet.create_table(range_name="A1:D5", table_name="AndLogicTable") + + # Update rows that are BOTH "Active" AND in "Engineering" (AND logic - default) + result = self.sheet.update_table_rows( + "AndLogicTable", + columns_to_match={"Status": ["Active"], "Department": ["Engineering"]}, + columns_to_modify={"Status": "Active - Eng", "Age": "Updated"}, + ) + + # Verify the update operation succeeded + self.assertIsNotNone(result) + + # Check that only rows matching BOTH conditions were updated + values = self.sheet.get_values("A1:D5") + expected = [ + ["Name", "Status", "Age", "Department"], + [ + "Alice", + "Active - Eng", + "Updated", + "Engineering", + ], # Active + Engineering (matched) + ["Bob", "Active", "30", "Sales"], # Active but not Engineering (no match) + ["Charlie", "Inactive", "35", "Engineering"], # Not Active (no match) + [ + "Diana", + "Active - Eng", + "Updated", + "Engineering", + ], # Active + Engineering (matched) + ] + self.assertEqual(values, expected) From 931782353a1bd200b34b7ba46434494076128196 Mon Sep 17 00:00:00 2001 From: Pedro Date: Sat, 27 Dec 2025 19:03:32 -0300 Subject: [PATCH 8/9] * Updated table fetching method to be public --- gspread/worksheet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 081cb970a..5ba79968b 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3586,7 +3586,7 @@ def _update_table( return self.client.batch_update(self.spreadsheet_id, body) - def _find_table_by_name( + def find_table_by_name( self, table_name: str, ) -> Optional[Dict[str, Any]]: @@ -3641,7 +3641,7 @@ def delete_table_row( >>> worksheet.delete_table_row("Users", 0) """ # Find the table by name - table_info = self._find_table_by_name(table_name) + table_info = self.find_table_by_name(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") @@ -3832,7 +3832,7 @@ def append_table_rows( return {"status": "completed", "message": "No rows to append"} # Find the table by name - table_info = self._find_table_by_name(table_name) + table_info = self.find_table_by_name(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") @@ -4019,7 +4019,7 @@ def update_table_rows( ... ) """ # Find the table by name - table_info = self._find_table_by_name(table_name) + table_info = self.find_table_by_name(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") From f076fb78c04a235bb5f610b593cd1e9a290d5333 Mon Sep 17 00:00:00 2001 From: Pedro Date: Tue, 30 Dec 2025 17:19:15 -0300 Subject: [PATCH 9/9] * added better method for table information retrieval --- gspread/worksheet.py | 97 ++- ...heetTest.test_get_table_by_name_basic.json | 664 ++++++++++++++++++ ...st.test_get_table_by_name_with_footer.json | 664 ++++++++++++++++++ tests/worksheet_test.py | 64 ++ 4 files changed, 1485 insertions(+), 4 deletions(-) create mode 100644 tests/cassettes/WorksheetTest.test_get_table_by_name_basic.json create mode 100644 tests/cassettes/WorksheetTest.test_get_table_by_name_with_footer.json diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 5ba79968b..429c3b822 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -3586,7 +3586,7 @@ def _update_table( return self.client.batch_update(self.spreadsheet_id, body) - def find_table_by_name( + def _get_table_info( self, table_name: str, ) -> Optional[Dict[str, Any]]: @@ -3615,6 +3615,95 @@ def find_table_by_name( return None + def get_table_by_name( + self, + table_name: str, + ) -> Dict[str, Any]: + """Get table data by its name in the worksheet. + + Returns a dictionary containing the table data organized by column names + and the table footer if present. + + Args: + table_name (str): The name of the table to get + + Returns: + dict: A dictionary with the following structure: + { + "data": { + "column_1_name": [value1, value2, ...], + "column_2_name": [value1, value2, ...], + ... + }, + "table_footer": [footer_value1, footer_value2, ...] or None + } + + Raises: + GSpreadException: If the table is not found + + Examples: + >>> table_data = worksheet.get_table_by_name("MyTable") + >>> print(table_data["data"]["Name"]) # List of values in Name column + >>> print(table_data["table_footer"]) # Footer row values or None + + .. versionadded:: 6.2.0 + """ + # Get table info using internal method + table_info = self._get_table_info(table_name) + if not table_info: + raise GSpreadException(f"Table '{table_name}' not found in worksheet") + + # Get the range of the table + table_range = table_info.get("range", {}) + start_row = table_range.get("startRowIndex", 0) + start_col = table_range.get("startColumnIndex", 0) + end_row = table_range.get("endRowIndex", 0) + end_col = table_range.get("endColumnIndex", 0) + + # Convert grid range to A1 notation + range_a1 = f"{rowcol_to_a1(start_row + 1, start_col + 1)}:{rowcol_to_a1(end_row, end_col)}" + + # Fetch all values in the table range + all_values = self.get_values(range_a1, pad_values=True) + + if not all_values: + return { + "data": {}, + "table_footer": None, + } + + # Check for footer + has_footer = bool(table_info.get("rowsProperties", {}).get("footerColorStyle")) + + # Extract headers (first row) + headers = all_values[0] + + # Extract data rows (excluding header) + data_rows = all_values[1:] + + # Separate footer from data rows if it exists + if has_footer and data_rows: + footer_row = data_rows[-1] + data_rows = data_rows[:-1] + else: + footer_row = None + + # Construct the result dictionary + result = { + "data": {}, + "table_footer": footer_row + } + + # Populate data by columns + for col_idx, header in enumerate(headers): + col_values = [] + for row in data_rows: + if col_idx < len(row): + col_values.append(row[col_idx]) + result["data"][header] = col_values + + return result + def delete_table_row( self, table_name: str, @@ -3641,7 +3730,7 @@ def delete_table_row( >>> worksheet.delete_table_row("Users", 0) """ # Find the table by name - table_info = self.find_table_by_name(table_name) + table_info = self._get_table_info(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") @@ -3832,7 +3921,7 @@ def append_table_rows( return {"status": "completed", "message": "No rows to append"} # Find the table by name - table_info = self.find_table_by_name(table_name) + table_info = self._get_table_info(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") @@ -4019,7 +4108,7 @@ def update_table_rows( ... ) """ # Find the table by name - table_info = self.find_table_by_name(table_name) + table_info = self._get_table_info(table_name) if not table_info: raise GSpreadException(f"Table '{table_name}' not found in worksheet") diff --git a/tests/cassettes/WorksheetTest.test_get_table_by_name_basic.json b/tests/cassettes/WorksheetTest.test_get_table_by_name_basic.json new file mode 100644 index 000000000..e3890f254 --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_get_table_by_name_basic.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_table_by_name_basic\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "114" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Server": [ + "ESF" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:53 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "201" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"name\": \"Test WorksheetTest test_get_table_by_name_basic\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:53 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3345" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_table_by_name_basic\",\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/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:54 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3345" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_table_by_name_basic\",\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/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:55 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw/values/%27Sheet1%27%21A1%3AC4?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Age\", \"City\"], [\"Alice\", 25, \"New York\"], [\"Bob\", 30, \"San Francisco\"], [\"Charlie\", 35, \"Boston\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "145" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:55 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"updatedRange\": \"Sheet1!A1:C4\",\n \"updatedRows\": 4,\n \"updatedColumns\": 3,\n \"updatedCells\": 12\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"TestTable\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "169" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:56 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "1304" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"1093552097\",\n \"name\": \"TestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:56 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "5898" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_table_by_name_basic\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 1093552097,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"1093552097\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"1093552097\",\n \"name\": \"TestTable\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw/values/%27Sheet1%27%21A1%3AC4", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:57 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "303" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C4\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\"\n ],\n [\n \"Bob\",\n \"30\",\n \"San Francisco\"\n ],\n [\n \"Charlie\",\n \"35\",\n \"Boston\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1JbWFwt1YNMZpqzdz3ybRxUTjAUuK7HHRIzC0ZncHBMw?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Pragma": [ + "no-cache" + ], + "Content-Type": [ + "text/html" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:57 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Content-Length": [ + "0" + ], + "X-XSS-Protection": [ + "0" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/cassettes/WorksheetTest.test_get_table_by_name_with_footer.json b/tests/cassettes/WorksheetTest.test_get_table_by_name_with_footer.json new file mode 100644 index 000000000..72903b65b --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_get_table_by_name_with_footer.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_table_by_name_with_footer\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "120" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Server": [ + "ESF" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:10:59 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "207" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"name\": \"Test WorksheetTest test_get_table_by_name_with_footer\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:00 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3351" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_table_by_name_with_footer\",\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/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:00 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "3351" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_table_by_name_with_footer\",\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/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:01 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "PUT", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg/values/%27Sheet1%27%21A1%3AC4?valueInputOption=RAW", + "body": "{\"values\": [[\"Name\", \"Age\", \"City\"], [\"Alice\", 25, \"New York\"], [\"Bob\", 30, \"San Francisco\"], [\"Charlie\", 35, \"Boston\"]], \"majorDimension\": null}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "145" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:01 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "169" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"updatedRange\": \"Sheet1!A1:C4\",\n \"updatedRows\": 4,\n \"updatedColumns\": 3,\n \"updatedCells\": 12\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg:batchUpdate", + "body": "{\"requests\": [{\"addTable\": {\"table\": {\"range\": {\"startRowIndex\": 0, \"endRowIndex\": 4, \"startColumnIndex\": 0, \"endColumnIndex\": 3, \"sheetId\": 0}, \"name\": \"TableWithFooter\"}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "175" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:02 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "1309" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"replies\": [\n {\n \"addTable\": {\n \"table\": {\n \"tableId\": \"433479070\",\n \"name\": \"TableWithFooter\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:02 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "5907" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_get_table_by_name_with_footer\",\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 \"frozenRowCount\": 1\n }\n },\n \"bandedRanges\": [\n {\n \"bandedRangeId\": 433479070,\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowProperties\": {\n \"headerColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n },\n \"firstBandColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"secondBandColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n },\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"bandedRangeReference\": \"433479070\"\n }\n ],\n \"tables\": [\n {\n \"tableId\": \"433479070\",\n \"name\": \"TableWithFooter\",\n \"range\": {\n \"startRowIndex\": 0,\n \"endRowIndex\": 4,\n \"startColumnIndex\": 0,\n \"endColumnIndex\": 3\n },\n \"rowsProperties\": {\n \"headerColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.20784314,\n \"green\": 0.40784314,\n \"blue\": 0.32941177\n }\n },\n \"firstBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n },\n \"secondBandColorStyle\": {\n \"rgbColor\": {\n \"red\": 0.9647059,\n \"green\": 0.972549,\n \"blue\": 0.9764706\n }\n }\n },\n \"columnProperties\": [\n {\n \"columnName\": \"Name\"\n },\n {\n \"columnIndex\": 1,\n \"columnName\": \"Age\"\n },\n {\n \"columnIndex\": 2,\n \"columnName\": \"City\"\n }\n ]\n }\n ]\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg/values/%27Sheet1%27%21A1%3AC4", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "x-l2-request-path": [ + "l2-managed-6" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:02 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-XSS-Protection": [ + "0" + ], + "content-length": [ + "303" + ] + }, + "body": { + "string": "{\n \"range\": \"Sheet1!A1:C4\",\n \"majorDimension\": \"ROWS\",\n \"values\": [\n [\n \"Name\",\n \"Age\",\n \"City\"\n ],\n [\n \"Alice\",\n \"25\",\n \"New York\"\n ],\n [\n \"Bob\",\n \"30\",\n \"San Francisco\"\n ],\n [\n \"Charlie\",\n \"35\",\n \"Boston\"\n ]\n ]\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1mlITAKxq8Jck1qINtQnjuXeI3mQDwPl_j9S0hT3WlCg?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.32.5" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Pragma": [ + "no-cache" + ], + "Content-Type": [ + "text/html" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Server": [ + "ESF" + ], + "Date": [ + "Tue, 30 Dec 2025 20:11:03 GMT" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Content-Length": [ + "0" + ], + "X-XSS-Protection": [ + "0" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 32ab85942..cdfa783d1 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -2357,3 +2357,67 @@ def test_update_table_rows_multiple_match_and_logic(self): ], # Active + Engineering (matched) ] self.assertEqual(values, expected) + + @pytest.mark.vcr() + def test_get_table_by_name_basic(self): + """Test getting table data by name without footer.""" + # Create a table with data + self.sheet.update( + [ + ["Name", "Age", "City"], + ["Alice", 25, "New York"], + ["Bob", 30, "San Francisco"], + ["Charlie", 35, "Boston"], + ], + "A1:C4", + ) + + # Create table + self.sheet.create_table(range_name="A1:C4", table_name="TestTable") + + # Get table data + table_data = self.sheet.get_table_by_name("TestTable") + + # Verify structure + self.assertIn("data", table_data) + self.assertIn("table_footer", table_data) + + # Verify data is organized by columns + self.assertEqual(table_data["data"]["Name"], ["Alice", "Bob", "Charlie"]) + self.assertEqual(table_data["data"]["Age"], ["25", "30", "35"]) + self.assertEqual(table_data["data"]["City"], ["New York", "San Francisco", "Boston"]) + + # Verify no footer + self.assertIsNone(table_data["table_footer"]) + + @pytest.mark.vcr() + def test_get_table_by_name_with_footer(self): + """Test getting table data by name with footer.""" + # Create a table with data + self.sheet.update( + [ + ["Name", "Age", "City"], + ["Alice", 25, "New York"], + ["Bob", 30, "San Francisco"], + ["Charlie", 35, "Boston"], + ], + "A1:C4", + ) + + # Create table + self.sheet.create_table(range_name="A1:C4", table_name="TableWithFooter") + + # Get table data + table_data = self.sheet.get_table_by_name("TableWithFooter") + + # Verify structure + self.assertIn("data", table_data) + self.assertIn("table_footer", table_data) + + # Verify data is organized by columns + self.assertEqual(table_data["data"]["Name"], ["Alice", "Bob", "Charlie"]) + self.assertEqual(table_data["data"]["Age"], ["25", "30", "35"]) + self.assertEqual(table_data["data"]["City"], ["New York", "San Francisco", "Boston"]) + + # Verify no footer (since we can't easily add a footer via API in tests) + self.assertIsNone(table_data["table_footer"])