# Google Sheets

Sync your ClearFeed requests and tickets to Google Sheets for advanced analytics, custom dashboards, and stakeholder reporting.

## What You Can Do

| Area                      | Examples                                                              |
| ------------------------- | --------------------------------------------------------------------- |
| **Request sync**          | Automatically keep requests updated in Sheets with hourly syncs       |
| **Custom dashboards**     | Build charts, pivot tables, and metrics tailored to your team         |
| **Stakeholder reporting** | Share live data with people who don't use ClearFeed                   |
| **Advanced analytics**    | Combine ClearFeed data with other sources for cross-platform insights |

***

## Sync ClearFeed Requests and Insights

### Request Sync

The Google Sheets integration automatically syncs ClearFeed requests to your spreadsheet. Requests are updated hourly, keeping your data fresh without manual work.

#### What Gets Synced

| Category                  | Fields                                              |
| ------------------------- | --------------------------------------------------- |
| **Request details**       | ID, title, state, priority, author, assignee, team  |
| **Timestamps**            | Created at, updated at, last message time           |
| **SLA metrics**           | First response time, resolution time, breach status |
| **Context**               | Channel, collection, customer, linked tickets       |
| **Custom fields**         | All custom field values for your account            |
| **Messages** *(optional)* | Full conversation history for each request          |

#### What You Can Do With the Data

Once your requests are in Sheets, you can:

* **Build pivot tables** — Break down requests by priority, assignee, collection, or customer
* **Track SLA compliance** — Visualize first response times and resolution times
* **Monitor team workload** — See request distribution across agents and teams
* **Identify trends** — Analyze request volume over time by channel or type
* **Create executive dashboards** — Share high-level metrics with leadership
* **Cross-reference data** — Combine with other business data in Sheets

#### Example Analytics

| Question                                | How to Answer                                             |
| --------------------------------------- | --------------------------------------------------------- |
| What's our average first response time? | Pivot table on `Requests.first_response_time_avg` by week |
| Which team has the most open requests?  | Filter by state = open, pivot by assignee team            |
| Are we meeting SLA?                     | Count requests where `SLA.first_response_breached = true` |
| Top customers by request volume?        | Pivot table on `customer.name` with count of requests     |

#### Getting Started with Request Sync

1. **Get your API token** from **Settings → Developer Settings**
2. **Create a Google Sheet** and open **Extensions → Apps Script**
3. **Copy the sync script** from the ClearFeed request-sync recipe
4. **Configure** your API key and collection preferences
5. **Run the initial sync** to populate your sheet

**Full Setup Guide:** [ClearFeed Request Sync Recipe](https://github.com/clearfeed/clearfeed-recipes/tree/main/integrations/google-sheets/request-sync)

### Insights Data

Import pre-aggregated analytics and reporting metrics from ClearFeed into Google Sheets. Build executive dashboards, track SLA compliance over time, and monitor team performance with insights data.

#### What Gets Synced

| Category           | Example Metrics                                               |
| ------------------ | ------------------------------------------------------------- |
| **Request counts** | Number of requests by priority, state, channel, or collection |
| **Response times** | Average, median, and percentile response times                |
| **SLA metrics**    | First response breach rate, resolution time breach rate       |
| **Time trends**    | Daily, weekly, or monthly breakdowns                          |

#### What You Can Do With the Data

* **Executive dashboards** — Share high-level metrics with leadership in a familiar format
* **SLA tracking** — Monitor compliance trends over time with line charts
* **Performance comparisons** — Compare metrics across teams, channels, or time periods
* **Forecasting** — Use historical trends to project capacity needs

#### Example Analytics

| Question                               | How to Answer                                     |
| -------------------------------------- | ------------------------------------------------- |
| Are we meeting SLA this month?         | Line chart of first response breach % over time   |
| Which channels have the most requests? | Bar chart of request count by channel             |
| Is our response time improving?        | Trend line of average first response time by week |

#### Getting Started with Insights Sync

1. **Get your API token** from **Settings → Developer Settings**
2. **Create a Google Sheet** and open **Extensions → Apps Script**
3. **Copy the insights script** from the ClearFeed insights-sync recipe
4. **Configure** your API token and query parameters
5. **Run the script** to populate your sheet

**Full Setup Guide:** [ClearFeed Insights Sync Recipe](https://github.com/clearfeed/clearfeed-recipes/tree/main/integrations/google-sheets/insights-sync)

***

## FAQs

1. **How often does request data sync?**\
   **Answer:** The integration runs automatically every hour after the initial setup. You can also trigger manual syncs from the Clearfeed Sync menu.
2. **Can I filter requests by collection?**\
   **Answer:** Yes, configure the script with a specific `COLLECTION_ID` to sync only that collection, or set it to `null` for all collections.
3. **Can I include message conversations?**\
   **Answer:** Yes, enable `INCLUDE_MESSAGES: true` in the script configuration to sync full conversation history for each request.
4. **Can I customize which fields sync?**\
   **Answer:** The script includes all standard request fields automatically. For custom field selection or data transformation, contact ClearFeed support.
