JSON to Google Sheet

A guide to automatically sending JSON data into a structured Google Sheet.

The JSON to Google Sheet Action is a powerful data handling tool that takes structured JSON data—specifically, an array of objects—and writes it directly into a Google Sheet. It's the perfect way to log workflow runs, create reports, build datasets, or save structured output from other actions.

Connection Setup

Before using this action, you must connect your Google Account to AgenticFlow.

  1. Navigate to Settings > Connections.

  2. Add a new Google Account Connection.

  3. Follow the prompts to authenticate with Google and grant AgenticFlow the necessary permissions to manage your Google Sheets. This is a one-time setup.

How it Works: Data Mapping

The action intelligently maps your JSON data to the sheet's structure.

  • Headers: The keys from the first JSON object in your input array are used to create the header row (the first row) in the Google Sheet.

  • Rows: Each JSON object in the array is then written as a new row in the sheet, with the values placed under the corresponding headers.

For this to work correctly, your input data must be an array of objects, and all objects should ideally have the same keys.

Configuration

Input Parameters

Parameter
Type
Description

Connection

Connection

Select the Google Account connection you set up earlier.

Input Data

Array

The array of JSON objects you want to write. (e.g., {{api_action.body.results}}).

Spreadsheet ID

Text

The ID of the target Google Sheet. You can find this in your Google Sheet's URL (.../spreadsheets/d/SPREADSHEET_ID/edit).

Sheet Name

Text

The name of the specific sheet (tab) to write to (e.g., "Sheet1").

Write Mode

Select

Choose how to write the data: Overwrite (clears the entire sheet before writing new data) or Append (adds the new data as rows after any existing content).

Example: Logging User Data

Imagine an API action fetches a list of new users. The output, {{api_action.body.users}}, looks like this:

[
  {
    "id": "usr_123",
    "name": "Alice",
    "email": "[email protected]",
    "status": "active"
  },
  {
    "id": "usr_456",
    "name": "Bob",
    "email": "[email protected]",
    "status": "pending"
  }
]
  1. Configure the Action:

    • Connection: Select your Google Account.

    • Input Data: {{api_action.body.users}}

    • Spreadsheet ID: 1aBcDeFgHiJkLmNoPqRsTuVwXyZ_...

    • Sheet Name: User Logs

    • Write Mode: Append

  2. Resulting Google Sheet (User Logs):

id
name
email
status

usr_123

Alice

active

usr_456

Bob

pending

The action automatically created the id, name, email, and status headers and added the two users as new rows. If the workflow runs again, two more rows will be added below these.

Last updated

Was this helpful?