# Send submission to Google Sheets spreadsheet

> Formspree Docs · Using the CLI · Updated July 14, 2023

Adding the **Google Sheets** action in the `formspree.json` file has the same effect as adding the Google Sheets plugin in the Formspree dashboard.

## Get your credentials

To use the Google Sheets plugin through CLI we need to create a service account in the Google Cloud console.

### 1\. Create a service account

Visit the [Google Cloud Console](https://console.cloud.google.com) ensuring that you are signed into the correct Google account. In the top right you'll see a list of projects.

  
![mceclip0.png](/images/zendesk/20ae06b8574ab09d.png)

If you already have a project, click the dropdown containing your project name, such as _Formspree Test Account_. If you don't have a project, it will appear differently. Clicking on the dropdown will show a modal with the _New Projects_ option.  
  
![mceclip1.png](/images/zendesk/b1ba54d504b7c56f.png)

Give a project name and create it

  
![mceclip2.png](/images/zendesk/499671dac6e1fab7.png)

### 2\. Create a service account

Access the service account option by searching on the search bar or in the side menu. If you have more than one project, you have to specify which project you want to use.

Click on **Create Service Account**.

![mceclip3.png](/images/zendesk/1a64a681d70abb18.png)

Add a service name and description and click **Done**.  
  
![mceclip4.png](/images/zendesk/ead9adf89fba5ab5.png)

You should see the account listed in the dashboard. We'll need the email account in the table for the `formspree.json` file.

## ![mceclip5.png](/images/zendesk/bf15ef4d16106432.png)

### 3\. Getting your private key

On the service account dashboard click on the **Actions** column of your last step created account row. Then click on **Create Key**, select the **JSON** option, and click **Create**.  
  
![mceclip6.png](/images/zendesk/e6e5556e0c0d4fe5.png)  
  

This will return to you a file to download containing the private key and another private service account data. Store this information securely. We'll need it in formspree.json configuration step.

### 4\. Enable Drive and Spreadsheet API

To create a spreadsheet Formspree requires you to use the Google Drive and sheets API using your credentials. For that, you need to enable both APIs on Google Cloud Console.

Select your project and access [https://console.cloud.google.com.](https://console.cloud.google.com) Write in the search bar **Google Drive API**. Click **Enable** on the resulting page to enable the API.  
  
Repeat this step by searching for **Google Sheets API**.  
![mceclip0.png](/images/zendesk/59935ef1cfded160.png)

## formspree.json configuration

| Key | Type | Description |
| --- | --- | --- |
| `app` |  String | Must be `googlesheets` |
| `privateKey` |  String | The `private_key` data that you have in the JSON file generated in [**Getting your key**](#h_01EVS55S2WNW8S6SM40QFGMZQG) step. |
| `serviceAccount` |  String | The service account email that you have received in the **Create a service account** step. You can see it in the JSON file that contains your service account data as `client_email`. You can also access the service account dashboard and copy the email column. |
| `type` |  String | Must be `sendToSpreadsheet` |
| `sendInvitationTo` |  String | Optional. The email that the spreadsheet created by Formspree will be shared. An email will be sent to the email configured there. Default: Your form target email and if not exists your account email. In this sequence. If both do not exist, an error will be shown on the console. |

**Example**

```javascript
{
  "forms": {
    "support": {
      "name": "Clients Spreadsheet",
      "actions": [
        {
          "app": "googlesheets",
          "privateKey": "$GOOGLE_SHEETS_KEY",
          "serviceAccount": "formspree-test-service-account@formspree-test-account.iam.gserviceaccount.com",
          "type": "sendToSpreadsheet",
          "sendInvitationTo": "other@email.com"
        }
      ]
    }
  }
}
```

## Validation rules

No validation rules are implicitly configured.
