Skip to main content
Glama

sheets_append_values

Add rows of data to a specified table in Google Sheets using a spreadsheet ID and A1 notation range. Choose how data is interpreted and inserted for precise control.

Instructions

Append values to the end of a table in a Google Sheets spreadsheet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
insertDataOptionNoHow the input data should be inserted (default: OVERWRITE)
rangeYesThe A1 notation range of the table to append to (e.g., "Sheet1!A:B")
spreadsheetIdYesThe ID of the spreadsheet (found in the URL after /d/)
valueInputOptionNoHow the input data should be interpreted (default: USER_ENTERED)
valuesYesA 2D array of values to append, where each inner array represents a row

Implementation Reference

  • The main handler function that validates input, authenticates with Google Sheets API, appends values, formats the response, and handles errors.
    export async function handleAppendValues(input: any) { try { const validatedInput = validateAppendValuesInput(input); const sheets = await getAuthenticatedClient(); const response = await sheets.spreadsheets.values.append({ spreadsheetId: validatedInput.spreadsheetId, range: validatedInput.range, valueInputOption: validatedInput.valueInputOption, insertDataOption: validatedInput.insertDataOption, requestBody: { values: validatedInput.values, }, }); return formatAppendResponse(response.data.updates || {}); } catch (error) { return handleError(error); } }
  • Input schema defining parameters for the sheets_append_values tool, including spreadsheetId, range, values, and optional formatting options.
    inputSchema: { type: 'object', properties: { spreadsheetId: { type: 'string', description: 'The ID of the spreadsheet (found in the URL after /d/)', }, range: { type: 'string', description: 'The A1 notation range of the table to append to (e.g., "Sheet1!A:B")', }, values: { type: 'array', items: { type: 'array', }, description: 'A 2D array of values to append, where each inner array represents a row', }, valueInputOption: { type: 'string', enum: ['RAW', 'USER_ENTERED'], description: 'How the input data should be interpreted (default: USER_ENTERED)', }, insertDataOption: { type: 'string', enum: ['OVERWRITE', 'INSERT_ROWS'], description: 'How the input data should be inserted (default: OVERWRITE)', }, }, required: ['spreadsheetId', 'range', 'values'], },
  • src/index.ts:39-39 (registration)
    Registers the handleAppendValues function as the executor for the 'sheets_append_values' tool in the toolHandlers Map.
    ['sheets_append_values', tools.handleAppendValues],
  • src/index.ts:74-74 (registration)
    Registers the appendValuesTool definition in the allTools array for listing available tools.
    tools.appendValuesTool,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/freema/mcp-gsheets'

If you have feedback or need assistance with the MCP directory API, please join our Discord server