{"record":{"id":"90aa83f67353e242","repo":"FlowiseAI/Flowise","slug":"failed-to-get-sheet-data-response-status-res","errorCode":null,"errorMessage":"Failed to get sheet data: ${response.status} ${response.statusText} - ${errorText}","messagePattern":"Failed to get sheet data: (.+?) (.+?) - (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/GoogleSheets/GoogleSheets.ts","lineNumber":348,"sourceCode":"\n    private async getSheetData(spreadsheetId: string, range: string, valueRenderOption: string, accessToken: string): Promise<any> {\n        const url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${encodeURIComponent(range)}`\n        const params = new URLSearchParams({\n            valueRenderOption,\n            dateTimeRenderOption: 'FORMATTED_STRING',\n            majorDimension: 'ROWS'\n        })\n\n        const response = await fetch(`${url}?${params}`, {\n            headers: {\n                Authorization: `Bearer ${accessToken}`,\n                'Content-Type': 'application/json'\n            }\n        })\n\n        if (!response.ok) {\n            const errorText = await response.text()\n            throw new Error(`Failed to get sheet data: ${response.status} ${response.statusText} - ${errorText}`)\n        }\n\n        return response.json()\n    }\n\n    private convertSheetToDocument(\n        sheetData: any,\n        sheetName: string,\n        spreadsheetId: string,\n        spreadsheetMetadata: any,\n        includeHeaders: boolean\n    ): IDocument {\n        const values = sheetData.values || []\n\n        if (values.length === 0) {\n            return {\n                pageContent: '',\n                metadata: {","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/GoogleSheets/GoogleSheets.ts#L330-L366","documentation":"Thrown by GoogleSheets.getSheetData after a non-ok response from GET https://sheets.googleapis.com/v4/spreadsheets/{id}/values/{range}. Includes status, statusText and the response body. Same auth failure modes as the metadata call, plus range-specific failures.","triggerScenarios":"400 INVALID_ARGUMENT when the range string (e.g. 'Sheet1!A1:Z') is malformed or references a sheet/tab name that does not exist; 403 when the token has metadata scope but not values read scope; 401/404/429 as in the metadata call.","commonSituations":"Sheet tab was renamed so the range prefix no longer matches; range uses A1 notation with a missing sheet name on a multi-tab spreadsheet; locale-specific column letters; querying a very large range that exceeds cell limits.","solutions":["Parse the status/body in the message: 400 → fix the range syntax and confirm the tab name; 401 → refresh token; 403 → fix scopes/sharing; 429 → backoff.","Validate the range matches an existing tab via the metadata call result before requesting values.","Use a fully-qualified range like 'TabName!A:Z' rather than a bare range when multiple tabs exist.","URL-encode the range (the code already calls encodeURIComponent) — ensure no manual double-encoding upstream."],"exampleFix":"// before\nconst url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${encodeURIComponent(range)}`\n// after - validate tab exists first, then query\nconst meta = await getSpreadsheetMetadata(spreadsheetId, accessToken)\nconst tabNames = meta.sheets.map(s => s.properties.title)\nconst tab = range.includes('!') ? range.split('!')[0] : range\nif (!tabNames.includes(tab)) throw new Error(`Tab '${tab}' not found. Available: ${tabNames.join(', ')}`)","handlingStrategy":"validation","validationCode":"// Validate A1 range syntax and tab existence before calling values endpoint\nfunction isValidA1Range(range) {\n  // allow 'Sheet1!A1:B2', 'Sheet1!A:Z', or whole-sheet 'Sheet1'\n  return /^('[^']+'|[^'!]+)!?[A-Z]+[0-9]*(:[A-Z]+[0-9]*)?$/.test(range) || /^[A-Za-z0-9 _]+$/.test(range)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await loader.getSheetData(id, range, valueRenderOption, token)\n} catch (e) {\n  if (/Failed to get sheet data:\\s*400/.test(e.message)) throw new Error(`Bad range '${range}': ${e.message}`, { cause: e })\n  throw e\n}","preventionTips":["Use fully-qualified ranges ('Tab!A:Z') on multi-tab spreadsheets.","Confirm the tab name via the metadata call before fetching values.","Avoid double-encoding the range (the loader already encodes).","Add backoff for 429 responses."],"tags":["google-sheets","http","a1-notation","api-status"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}