fix: quote sheet name in Google Sheets API ranges
CI/CD / deploy (push) Failing after 1m31s Details

Sheet names with spaces need single-quoting in range strings,
otherwise 'Booking Sheet!A:J' fails to parse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-04-14 15:14:54 -04:00
parent e155408d9c
commit 6b8bf32c3b
1 changed files with 4 additions and 2 deletions

View File

@ -113,10 +113,11 @@ async function parseBookingSheet() {
return null;
}
const sheetName = process.env.BOOKING_SHEET_TAB || 'Booking Sheet';
const quotedName = `'${sheetName}'`;
const response = await sheets.spreadsheets.values.get({
spreadsheetId: sheetId,
range: `${sheetName}!A:J`,
range: `${quotedName}!A:J`,
});
const rows = response.data.values || [];
@ -249,6 +250,7 @@ async function assignBooking(guestName, accommodationType, selectedDays) {
const sheets = await getSheetsClient();
const sheetId = process.env.BOOKING_SHEET_ID;
const sheetName = process.env.BOOKING_SHEET_TAB || 'Booking Sheet';
const quotedName = `'${sheetName}'`;
const rowNum = bed.rowIndex + 1; // Sheets is 1-indexed
// Build batch update data for each selected day column
@ -258,7 +260,7 @@ async function assignBooking(guestName, accommodationType, selectedDays) {
if (colIdx === undefined) continue;
const colLetter = colIdxToLetter(colIdx);
data.push({
range: `${sheetName}!${colLetter}${rowNum}`,
range: `${quotedName}!${colLetter}${rowNum}`,
values: [[guestName]],
});
}