Add Rows to Google Sheets
Introduction
The Soracom Flux Webhook Action supports Google Service Account authentication, which lets Flux automatically obtain an OAuth 2.0 access token before sending the request. With this authentication method, you can call Google APIs such as the Google Sheets API or the BigQuery API directly from your Flux app.
This guide walks you through configuring a Flux app that uses the API/Manual Execution Event Source to append a row to a Google Sheets spreadsheet whenever a request is sent to the channel endpoint.
Refer to the Pricing & Fee Schedule for detailed information on Soracom Flux pricing. Soracom Flux includes a free tier providing limited usage for certain features at no cost.
Requirements
For this project, you will need the following:
-
A Soracom account
If you don't already have a Soracom account, follow the steps in the Quick Start guide.
- A Google Cloud project with permission to create a service account and enable APIs.
- A Google Sheets spreadsheet that you can share with the service account.
Step 1: Create a Service Account in Google Cloud and Grant Permissions
To allow the Flux Webhook Action to call the Google Sheets API in your Google Cloud project, create a service account, download its JSON key, and grant the service account access to the target Google Sheets spreadsheet.
Enable the Google Sheets API
In the Google Cloud Console, select the project in which you want to create the service account, and enable the Google Sheets API.
To use other Google APIs (such as BigQuery or Drive), enable each API individually.
Create the Service Account
In IAM & Admin → Service Accounts, click Create service account and configure the following:
- Service account name: Enter any name, for example
flux-sheets-integration. - Service account ID: Leave the auto-generated value as is.
- Service account description: Describe the intended use of the account.
Click Create and continue, skip role assignment, then click Done.
The email address of the new service account (e.g., flux-sheets-integration@<PROJECT_ID>.iam.gserviceaccount.com) is referred to as ${service_account_email} from this point onward.
Create a JSON Key
Open the service account you created, and click Keys → Add key → Create new key. Select JSON as the key type and click Create.
A JSON file is downloaded. The contents of this file are referred to as ${service_account_json} from this point onward.
The downloaded JSON file is sensitive information. Do not paste it into chat tools, email, or Git repositories. After registering it in Credential Sets, we recommend deleting the local copy.
Share the Google Sheets Spreadsheet with the Service Account
Open the target Google Sheets spreadsheet and click Share. Enter ${service_account_email}, set the permission to Editor, and send. Clear the Notify people checkbox.
The <SPREADSHEET_ID> from the spreadsheet URL https://docs.google.com/spreadsheets/d/<SPREADSHEET_ID>/edit is referred to as ${spreadsheet_id} from this point onward.
We recommend granting access at the resource level (principle of least privilege) rather than granting project-wide access.
Step 2: Register the Google Service Account (JSON) Credential Set
To allow Flux to call Google APIs, register the service account JSON key as a Credential Set in the Soracom User Console.
In the Register credentials dialog of Credential Sets, configure the following. For instructions on how to open this dialog, refer to Creating a Credential Set.
| Field | Description |
|---|---|
| Credential set ID | Enter any descriptive name to identify the credentials, for example flux-sheets-integration. |
| Type | Select Google Service Account (JSON credentials). |
| Credentials | Paste the entire contents of ${service_account_json} (the JSON file downloaded in Step 1). |
For details on the available fields, refer to Credential Sets.
Step 3: Create a Flux App
A Flux app can integrate various forms of inputs and apply sophisticated business logic to achieve desired outcomes.
-
Sign in to the User Console. From the Menu, expand Soracom Flux and select Flux Apps.
-
Click Create a new Flux app.
-
Name the Flux app and provide an optional description, then click Create.
The Flux app will be created and the Studio tab in Soracom Flux Studio will automatically be displayed.
Create a Channel
A channel is a Flux component that connects an event source to actions in your Flux app.
-
Open the Studio tab in Soracom Flux Studio.
-
Click Create a channel.
-
Choose API/Manual Execution as the event source and click Next.
-
Configure the following:
- Name: Name your channel.
- Description: Optionally provide a summary of the channel.
-
Click Create a new channel.
- After confirming that your configuration is correct, click the to return to the Studio tab.
Create a Webhook Action
This step configures a Webhook action within your Flux app. When triggered, the action calls the Google Sheets API and appends a new row to the target Google Sheets spreadsheet.
For details on the Webhook Action, refer to the Webhook Action reference. For details on the Google Service Account authentication fields, refer to Auth Type in the same reference.
-
Click on the channel created in the previous section to open the configuration dialog, then select the Actions tab and click Add Action.
-
In the Create a new action dialog, choose Webhook as your action type, then click OK.
-
Configure the following:
- Name: Enter an action name.
- Description: Optionally provide a summary.
- Enabled: Set the action to enabled.
- Condition:
- Action Condition: Leave this field blank so that the action executes each time it is called.
-
Configure the following in the Config section of the dialog:
- HTTP Method: Select POST.
-
URL: Enter the Google Sheets API
values.appendendpoint that includes${spreadsheet_id}from Step 1:https://sheets.googleapis.com/v4/spreadsheets/${spreadsheet_id}/values/Sheet1!A1:append?valueInputOption=USER_ENTEREDIf the tab name in your spreadsheet is not
Sheet1, replaceSheet1with the correct tab name. - Auth Type: Select Google Service Account.
- Credentials: Select the credential set registered in Step 2, for example
flux-sheets-integration. - Scope: Enter
https://www.googleapis.com/auth/spreadsheets. -
Subject: Leave blank.
For the list of supported scopes, refer to Google for Developers' OAuth 2.0 Scopes for Google APIs documentation. Set Subject only when using Google Workspace domain-wide delegation.
- HTTP Headers: Selecting application/json for HTTP Body automatically sets
Content-Type: application/json. -
HTTP Body: Select application/json and enter the following:
{ "majorDimension": "ROWS", "values": [ ["${payload.deviceId}", "${payload.timestamp}", "${payload.temperature}", "${payload.humidity}"] ] }
-
Configure the following in the Output section of the dialog:
- Republish this action output to another channel: Set republishing to Disabled.
-
Click Create.
- After confirming that your configuration is correct, click the to return to the Studio tab.
Testing
Send a Message from the API/Manual Execution Channel
-
From the Menu, expand Soracom Flux and select Flux Apps.
-
Select your Flux app for this project.
-
Click on the channel created in the Create a Channel section to open the configuration dialog and select the Test tab.
-
In Content Type, select application/json, then enter the following in the Body field and click Execute:
{ "deviceId": "test-device-001", "timestamp": "2026-05-13T11:00:00+09:00", "temperature": 25.3, "humidity": 60.5 }
Verify That the Row Was Appended in Google Sheets
Open the Google Sheets spreadsheet you shared in Step 1, and confirm that the deviceId, timestamp, temperature, and humidity values from the previous step have been appended as the last row.
Check the Execution History of the Flux App
-
Sign in to the User Console. From the Menu, expand Soracom Flux and select Flux Apps.
-
Click on the Flux app you created.
-
Select the History tab.
For each channel, the Message, Context, Input, and Output of the action executed from that channel are displayed. If
updates.updatedRowsin the Webhook Action Output is1, the row was appended to the Google Sheets spreadsheet successfully.
To learn about detailed logging, see the View Logs documentation.