> ## Documentation Index
> Fetch the complete documentation index at: https://docs.segmentstream.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Sheets

> Import cost data into SegmentStream from Google Sheets for any advertising platform.

Using Google Sheets as a data source is a universal way to import any type of data even if you did not find an appropriate data source inside the SegmentStream admin panel.

## Creating a costs sheet

To import costs into SegmentStream, you need to create a Google Sheet where the data is listed in the following format.

<Tip>
  Use [this template](https://docs.google.com/spreadsheets/d/1TBiJkySz7BfAzVbEq3KyMzNkLJDKqE0DhG5ECyDAGQU/edit#gid=0) for daily costs.
</Tip>

| Name        | Type    | Required     | Description                                                                        | Example             |
| ----------- | ------- | ------------ | ---------------------------------------------------------------------------------- | ------------------- |
| date        | DATE    | **required** | Reporting date in `YYYY-MM-DD` format                                              | 2020-04-03          |
| currency    | STRING  | **required** | Currency code                                                                      | USD                 |
| cost        | FLOAT   | **required** | Total spendings for the reporting date                                             | 460.5               |
| impressions | INTEGER | optional     | Total number of impressions during the day                                         | 12500               |
| clicks      | INTEGER | optional     | Total number of clicks during the day                                              | 284                 |
| utmMedium   | STRING  | **required** | `utm_medium` URL parameter attributed to the costs entry                           | cpa                 |
| utmSource   | STRING  | **required** | `utm_source` URL parameter attributed to the costs entry                           | partner1            |
| utmCampaign | STRING  | optional     | `utm_campaign` URL parameter attributed to the costs entry                         | campaign1           |
| utmTerm     | STRING  | optional     | `utm_term` URL parameter attributed to the costs entry                             | black\_shoes        |
| utmContent  | STRING  | optional     | `utm_content` URL parameter attributed to the costs entry                          | bottom\_cta\_button |
| campaign    | STRING  | optional     | The name of the campaign as it will be reported inside SegmentStream               | Example Campaign    |
| campaignId  | STRING  | optional     | The ID of the campaign that will allow SegmentStream to match it to URL parameters | 123123              |

## Monthly costs import

Sometimes it might be required to import monthly costs (subscriptions, salaries) and attribute them to a specific set of UTM parameters, for example:

* SEO costs
* CDP/ESP costs
* PR costs

<Tip>
  Use [this template](https://docs.google.com/spreadsheets/d/1tBYrGf7PcXvTQqxBKsnwxc-aojgcRLJft9VMXwKt86E/edit#gid=0) for uploading monthly costs.
</Tip>

For example, if you spent \$3000 each month of the first quarter of 2024 on your favorite ESP platform and would like to attribute these costs to `utm_source=my_esp` and `utm_medium=email`, you can structure your sheet as follows:

| month      | currency | cost | impressions | clicks | utmSource | utmMedium |
| ---------- | -------- | ---- | ----------- | ------ | --------- | --------- |
| 2024-01-01 | USD      | 3000 |             |        | email     | my\_esp   |
| 2024-02-01 | USD      | 3000 |             |        | email     | my\_esp   |
| 2024-03-01 | USD      | 3000 |             |        | email     | my\_esp   |

## Enabling Google Sheets data source

<Steps>
  <Step title="Navigate to Data Sources">
    Go to the [SegmentStream admin panel](https://app.segmentstream.com/). Go to the **Data Sources** section and click **+ NEW**.
  </Step>

  <Step title="Select Google Sheets">
    Select **Google Sheets**.
  </Step>

  <Step title="Authenticate">
    Click **Authenticate with Google** and go through the authentication flow.
  </Step>

  <Step title="Enter spreadsheet URL">
    In the **Google Spreadsheet URL** field specify the URL of the sheet that you want to import.
  </Step>

  <Step title="Select report type">
    Select the **Daily cost data group by UTM** or **Monthly cost data grouped by UTM** report type.
  </Step>

  <Step title="Set destination table">
    In the **Destination table name** field specify a unique BigQuery table name where you would like to store the data imported from the specified sheet, for example, `daily_costs_platform_name`.
  </Step>
</Steps>

## Custom Google Sheets report type

Custom Google Sheets report types allow you to upload data that requires additional processing before being used in SegmentStream reports. Before using this feature, contact your SegmentStream manager.

To enable a custom Google Sheets upload, follow steps 1 through 5 from the previous section, then:

1. Select **Custom** report type.
2. Map sheet columns to proper data types:
   * **date** -> `DATE`
   * **cost** -> `FLOAT`
   * **impressions** -> `INTEGER`
   * **clicks** -> `INTEGER`

By default, all other columns will be imported as **String**.

## What's next

During the next 24 hours your data will be uploaded to the corresponding BigQuery table.
