diff --git a/homeassistant/components/google_sheets/services.py b/homeassistant/components/google_sheets/services.py index 5ccd825715ada..6b3794d6e2633 100644 --- a/homeassistant/components/google_sheets/services.py +++ b/homeassistant/components/google_sheets/services.py @@ -67,7 +67,7 @@ def _append_to_sheet(call: ServiceCall, entry: GoogleSheetsConfigEntry) -> None: raise HomeAssistantError("Failed to write data") from ex worksheet = sheet.worksheet(call.data.get(WORKSHEET, sheet.sheet1.title)) - columns: list[str] = next(iter(worksheet.get_values("A1:ZZ1")), []) + columns: list[str] = next(iter(worksheet.get_values("1:1")), []) add_created_column = call.data[ADD_CREATED_COLUMN] now = str(dt_util.now()) rows = [] diff --git a/tests/components/google_sheets/test_init.py b/tests/components/google_sheets/test_init.py index bdca277985500..fcd4ba7071d68 100644 --- a/tests/components/google_sheets/test_init.py +++ b/tests/components/google_sheets/test_init.py @@ -346,6 +346,7 @@ async def test_append_sheet_created_column_uses_configured_time_zone( rows_data = mock_worksheet.append_rows.call_args[0][0] assert rows_data[0] == ["bar", "2024-01-15 23:30:45.123456+11:00"] + mock_worksheet.get_values.assert_called_once_with("1:1") async def test_get_sheet(