FlowiseAI/Flowise · error · Error

Failed to get sheet data: ${response.status} ${response.stat

Error message

Failed to get sheet data: ${response.status} ${response.statusText} - ${errorText}

What it means

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.

Source

Thrown at packages/components/nodes/documentloaders/GoogleSheets/GoogleSheets.ts:348

    private async getSheetData(spreadsheetId: string, range: string, valueRenderOption: string, accessToken: string): Promise<any> {
        const url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${encodeURIComponent(range)}`
        const params = new URLSearchParams({
            valueRenderOption,
            dateTimeRenderOption: 'FORMATTED_STRING',
            majorDimension: 'ROWS'
        })

        const response = await fetch(`${url}?${params}`, {
            headers: {
                Authorization: `Bearer ${accessToken}`,
                'Content-Type': 'application/json'
            }
        })

        if (!response.ok) {
            const errorText = await response.text()
            throw new Error(`Failed to get sheet data: ${response.status} ${response.statusText} - ${errorText}`)
        }

        return response.json()
    }

    private convertSheetToDocument(
        sheetData: any,
        sheetName: string,
        spreadsheetId: string,
        spreadsheetMetadata: any,
        includeHeaders: boolean
    ): IDocument {
        const values = sheetData.values || []

        if (values.length === 0) {
            return {
                pageContent: '',
                metadata: {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. 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.
  2. Validate the range matches an existing tab via the metadata call result before requesting values.
  3. Use a fully-qualified range like 'TabName!A:Z' rather than a bare range when multiple tabs exist.
  4. URL-encode the range (the code already calls encodeURIComponent) — ensure no manual double-encoding upstream.

Example fix

// before
const url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${encodeURIComponent(range)}`
// after - validate tab exists first, then query
const meta = await getSpreadsheetMetadata(spreadsheetId, accessToken)
const tabNames = meta.sheets.map(s => s.properties.title)
const tab = range.includes('!') ? range.split('!')[0] : range
if (!tabNames.includes(tab)) throw new Error(`Tab '${tab}' not found. Available: ${tabNames.join(', ')}`)
Defensive patterns

Strategy: validation

Validate before calling

// Validate A1 range syntax and tab existence before calling values endpoint
function isValidA1Range(range) {
  // allow 'Sheet1!A1:B2', 'Sheet1!A:Z', or whole-sheet 'Sheet1'
  return /^('[^']+'|[^'!]+)!?[A-Z]+[0-9]*(:[A-Z]+[0-9]*)?$/.test(range) || /^[A-Za-z0-9 _]+$/.test(range)
}

Try / catch

try {
  await loader.getSheetData(id, range, valueRenderOption, token)
} catch (e) {
  if (/Failed to get sheet data:\s*400/.test(e.message)) throw new Error(`Bad range '${range}': ${e.message}`, { cause: e })
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/90aa83f67353e242. Report an issue: GitHub.