From e5220f1b69317374d172c26b1416cbd41af2f039 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 7 Apr 2026 15:13:37 +0000 Subject: [PATCH] Fix Sheets API 400 by quoting sheet names with spaces in range The Sheets API requires sheet names containing spaces to be wrapped in single quotes in the range parameter (e.g. 'Tip History'). https://claude.ai/code/session_011LY1ZZDXKuvy13nZQpySZU --- src/lib/server/sheets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/server/sheets.ts b/src/lib/server/sheets.ts index 4a54a42..fd62874 100644 --- a/src/lib/server/sheets.ts +++ b/src/lib/server/sheets.ts @@ -23,7 +23,7 @@ export async function appendToSheet( credJson: string ): Promise { const token = await getToken(credJson); - const range = encodeURIComponent(sheetName); + const range = encodeURIComponent(`'${sheetName}'`); const url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS`; const res = await fetch(url, {