ToolJet/ToolJet · error · Error

Spreadsheet title is required

Error message

Spreadsheet title is required

What it means

Thrown by createSpreadSheet() in the v1 googlesheets plugin when the title argument is falsy. The guard rejects empty/undefined titles before any HTTP call to the Google Sheets API, because a spreadsheet cannot be created without a name. Note the check is a loose truthiness test (`!title`), so a whitespace-only string like ' ' passes the guard but produces a poorly-named spreadsheet.

Source

Thrown at plugins/packages/googlesheets/lib/operations.ts:64

async function makeRequestToListAllSheets(spreadsheet_id: string, authHeader: any): Promise<SpreadsheetResponseBody> {
  const url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheet_id}`;

  return await got.get(url, { headers: authHeader }).json();
}

export async function listAllSheets(spreadsheet_id: string, authHeader: any): Promise<SpreadsheetResponseBody> {
  try {
    const response = await makeRequestToListAllSheets(spreadsheet_id, authHeader);
    return { sheets: response.sheets };
  } catch (error) {
    throw new Error(`Error fetching all sheets: ${error.response?.statusCode || ''} ${error.message}`);
  }
}

export async function createSpreadSheet(title: string, authHeader: any) {
  if (!title) {
    throw new Error('Spreadsheet title is required');
  }
  const requestBody = {
    properties: {
      title: title,
    },
  };

  try {
    const response = await makeRequestToCreateSpreadsheet(requestBody, authHeader);
    return { spreadsheetId: response.spreadsheetId };
  } catch (error) {
    throw new Error(`Error creating spreadsheet: ${error.response?.statusCode || ''} ${error.message}`);
  }
}

export async function batchUpdateToSheet(
  spreadSheetId: string,
  spreadsheetRange = 'A1:Z500',

View on GitHub (pinned to 20602a8e10)

Solutions

  1. Trim and validate the title before calling createSpreadSheet: reject empty and whitespace-only strings client-side.
  2. Provide a sensible default name (e.g. timestamped) when the user leaves the field blank.
  3. Surface a required-field error in the UI so the call is never made with a missing title.

Example fix

// before
await createSpreadSheet(titleInput.value, authHeader);

// after
const title = (titleInput.value || '').trim();
if (!title) throw new Error('Title cannot be empty');
await createSpreadSheet(title, authHeader);
Defensive patterns

Strategy: validation

Validate before calling

function assertCreateTitle(title: unknown): asserts title is string {
  if (typeof title !== 'string' || title.trim().length === 0) {
    throw new Error('Spreadsheet title is required');
  }
}
assertCreateTitle(title); // before createSpreadSheet(title, authHeader)

Type guard

const isValidTitle = (t: unknown): t is string =>
  typeof t === 'string' && t.trim().length > 0;

Try / catch

try { await createSpreadSheet(title, authHeader); }
catch (e) {
  if (/title is required/i.test(e.message)) ui.warn('Please enter a spreadsheet title');
  else throw e;
}

Prevention

When it happens

Trigger: Calling createSpreadsheet with an empty string, undefined, null, or 0 as the title. Commonly the title is bound from a ToolJet UI text input that the user left blank.

Common situations: A form field for the spreadsheet title is not filled; the bound component returns an empty string by default; a downstream transform strips the value to '' before the call.

Related errors


AI-assisted analysis of ToolJet/ToolJet@20602a8e10 (2026-08-13). Data as JSON: /api/errors/204c8958e7d311a5. Report an issue: GitHub.