Skip to main content
Glama

append_row

Add new rows to the end of Google Sheets spreadsheets programmatically to maintain updated data records and automate spreadsheet management tasks.

Instructions

スプレッドシートの最後に新しい行を追加します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sheetNameYesシート名
spreadsheetIdYesスプレッドシートのID
valuesYes追加する行のデータ

Implementation Reference

  • The main handler function that executes the append_row tool by appending the provided values as a new row to the end of the specified sheet in the Google Spreadsheet using the Google Sheets API's append method.
    async function appendRow( spreadsheetId: string, sheetName: string, values: string[] ) { const authClient = await auth.getClient(); const sheets = google.sheets({ version: "v4", auth: authClient as any }); const response = await sheets.spreadsheets.values.append({ spreadsheetId, range: `${sheetName}!A:Z`, valueInputOption: "RAW", requestBody: { values: [values], }, }); return { content: [ { type: "text", text: `行が正常に追加されました。更新されたセル数: ${response.data.updates?.updatedCells}`, }, ], }; }
  • The input schema for the append_row tool, defining the required parameters: spreadsheetId (string), sheetName (string), and values (array of strings).
    inputSchema: { type: "object", properties: { spreadsheetId: { type: "string", description: "スプレッドシートのID", }, sheetName: { type: "string", description: "シート名", }, values: { type: "array", items: { type: "string", }, description: "追加する行のデータ", }, }, required: ["spreadsheetId", "sheetName", "values"], },
  • src/index.ts:84-108 (registration)
    The tool registration definition in the tools array returned by ListToolsRequestHandler, including name, description, and inputSchema.
    { name: "append_row", description: "スプレッドシートの最後に新しい行を追加します", inputSchema: { type: "object", properties: { spreadsheetId: { type: "string", description: "スプレッドシートのID", }, sheetName: { type: "string", description: "シート名", }, values: { type: "array", items: { type: "string", }, description: "追加する行のデータ", }, }, required: ["spreadsheetId", "sheetName", "values"], }, },
  • src/index.ts:170-175 (registration)
    The dispatch case in the CallToolRequestHandler switch statement that routes 'append_row' calls to the appendRow handler function.
    case "append_row": return await appendRow( args.spreadsheetId as string, args.sheetName as string, args.values as string[] );

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/Kyohei-9841/google-spreadsheet-MCP'

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