> For the complete documentation index, see [llms.txt](https://docs.agenticflow.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agenticflow.ai/reference/nodes/json_to_google_sheet.md).

# JSON to Google Sheet

**Action ID:** `json_to_google_sheet`

## Description

Create a new Google Sheet from JSON data and configure sharing permissions automatically.

## Input Parameters

| Name        | Type     | Required | Default | Description                                                                                         |
| ----------- | -------- | :------: | ------- | --------------------------------------------------------------------------------------------------- |
| title       | string   |     ✓    | -       | Title of the Google Sheet to be created                                                             |
| data        | string   |     ✓    | -       | Data in JSON format to insert into the sheet. Can be a list of JSON objects or a single JSON object |
| share\_with | array    |     -    | null    | Email addresses to share the sheet with. If not provided, the sheet will be shared with anyone      |
| role        | string   |     -    | reader  | Role of the users to share with. Fixed value: reader                                                |
| prem\_type  | dropdown |     -    | anyone  | The account type to share with. Available options: user, group, domain, anyone                      |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Create Google Sheet node input.",
  "properties": {
    "title": {
      "description": "Title of the Google Sheet.",
      "title": "Title",
      "type": "string"
    },
    "data": {
      "description": "Data to be inserted into the Google Sheet. Data can be a list of JSON objects or a JSON object.",
      "title": "Data in JSON format",
      "type": "string"
    },
    "share_with": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Emails to share the Google Sheet with. If not provided, the Google Sheet will be shared with anyone.",
      "title": "Share with"
    },
    "role": {
      "const": "reader",
      "default": "reader",
      "description": "Role of the user to be shared with.",
      "title": "Role",
      "type": "string"
    },
    "prem_type": {
      "default": "anyone",
      "description": "The account type to be shared with. Default is anyone.",
      "enum": [
        "user",
        "group",
        "domain",
        "anyone"
      ],
      "title": "The account type",
      "type": "string"
    }
  },
  "required": [
    "title",
    "data"
  ],
  "title": "JsonToGoogleSheetNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name       | Type   | Description                         |
| ---------- | ------ | ----------------------------------- |
| sheet\_url | string | The URL of the created Google Sheet |
| sheet\_id  | string | The unique ID of the Google Sheet   |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Create Google Sheet node output.",
  "properties": {
    "sheet_url": {
      "description": "URL of the Google Sheet.",
      "title": "Sheet URL",
      "type": "string"
    },
    "sheet_id": {
      "description": "ID of the Google Sheet.",
      "title": "Sheet ID",
      "type": "string"
    }
  },
  "required": [
    "sheet_url",
    "sheet_id"
  ],
  "title": "JsonGoogleSheetNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node takes JSON data and creates a new Google Sheet with the specified title. It parses the JSON data structure, converts it into rows and columns, creates the spreadsheet in your Google Drive, and configures sharing permissions based on your specifications. If the data is an array of objects, each object becomes a row with keys as column headers. The node returns both the sheet URL for direct access and the sheet ID for programmatic operations.

## Usage Examples

### Example 1: Create Sheet from Array of Objects

**Input:**

```
title: "Customer List"
data: '[
  {"name": "John Doe", "email": "john@example.com", "status": "active"},
  {"name": "Jane Smith", "email": "jane@example.com", "status": "inactive"}
]'
share_with: ["team@example.com"]
prem_type: "user"
```

**Output:**

```
sheet_url: "https://docs.google.com/spreadsheets/d/abc123xyz/edit"
sheet_id: "abc123xyz"
```

### Example 2: Create Public Report Sheet

**Input:**

```
title: "Monthly Sales Report"
data: '{
  "total_sales": 150000,
  "units_sold": 1500,
  "average_price": 100,
  "top_product": "Widget A"
}'
share_with: null
prem_type: "anyone"
```

**Output:**

```
sheet_url: "https://docs.google.com/spreadsheets/d/def456uvw/edit"
sheet_id: "def456uvw"
```

### Example 3: Create Team Collaboration Sheet

**Input:**

```
title: "Project Tasks"
data: '[
  {"task": "Design mockups", "assigned_to": "Alice", "status": "In Progress"},
  {"task": "Write documentation", "assigned_to": "Bob", "status": "Pending"},
  {"task": "Code review", "assigned_to": "Charlie", "status": "Complete"}
]'
share_with: ["alice@company.com", "bob@company.com", "charlie@company.com"]
prem_type: "user"
```

**Output:**

```
sheet_url: "https://docs.google.com/spreadsheets/d/ghi789rst/edit"
sheet_id: "ghi789rst"
```

## Common Use Cases

* **Report Generation**: Automatically create shareable reports from workflow data
* **Data Export**: Export workflow results to Google Sheets for analysis and visualization
* **Team Collaboration**: Share data with team members for collaborative review and editing
* **Data Backup**: Create Google Sheets backups of important workflow data
* **API Response Storage**: Store API responses in structured spreadsheet format
* **Dashboard Data**: Generate data sheets for Google Sheets-based dashboards
* **Audit Trails**: Create timestamped records of workflow executions and results

## Error Handling

| Error Type           | Cause                                              | Solution                                                    |
| -------------------- | -------------------------------------------------- | ----------------------------------------------------------- |
| Authentication Error | Google account credentials are invalid or expired  | Re-authenticate your Google connection in AgenticFlow       |
| Invalid JSON         | Data parameter contains malformed JSON             | Validate and fix the JSON syntax before passing to the node |
| Permission Denied    | Insufficient permissions to create sheets or share | Check Google Drive permissions and OAuth scopes             |
| Invalid Email        | Email address in share\_with is invalid            | Verify all email addresses are properly formatted           |
| Quota Exceeded       | Google Sheets API quota limit reached              | Wait for quota reset or request quota increase              |
| Empty Data           | Data parameter is empty or null                    | Ensure data contains valid JSON content                     |

## Notes

* **JSON Format**: The data must be valid JSON. Arrays of objects create multi-row sheets; single objects create key-value pairs.
* **Column Headers**: When using an array of objects, the keys of the first object become column headers.
* **Sharing Options**: Setting prem\_type to "anyone" makes the sheet publicly accessible with the link.
* **Default Role**: Users are always shared with "reader" role. For edit access, modify permissions in Google Sheets directly.
* **Google Drive Storage**: Created sheets are stored in your Google Drive and count toward your storage quota.
* **Sheet Limits**: Google Sheets has limits on cells (10 million) and columns (18,278). Large datasets may need splitting.
