diff --git a/homeassistant/components/google_sheets/services.py b/homeassistant/components/google_sheets/services.py index 613627015887..91f70f0c680c 100644 --- a/homeassistant/components/google_sheets/services.py +++ b/homeassistant/components/google_sheets/services.py @@ -72,7 +72,7 @@ def _append_to_sheet(call: ServiceCall, entry: GoogleSheetsConfigEntry) -> None: client = Client(Credentials(entry.data[CONF_TOKEN][CONF_ACCESS_TOKEN])) # type: ignore[no-untyped-call] sheet = client.open_by_key(entry.unique_id) worksheet = _get_worksheet(sheet, call.data.get(WORKSHEET)) - 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 c6c5cf17e007..5887e7f718ad 100644 --- a/tests/components/google_sheets/test_init.py +++ b/tests/components/google_sheets/test_init.py @@ -347,6 +347,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(