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

# Sync Google Sheets to Audience Segments

> Step-by-step tutorial on automatically importing leads and contacts from Google Sheets into Mailofly audience segments.

# Sync Google Sheets to Audience Segments

Learn how to connect a Google Sheet to Mailofly and automatically keep your audience segments synchronized with fresh leads, event attendees, or waitlist signups—without manual CSV exports.

***

## The Problem It Solves

Marketing, sales, and operations teams frequently collect customer data in spreadsheets:

* Google Forms or Typeform responses collected in a Google Sheet.
* Event attendees or webinar registrations managed by team members.
* Inbound sales leads qualified manually in spreadsheets.

Traditionally, transferring this data into your email platform requires:

1. Exporting a CSV from Google Sheets every week or day.
2. Cleaning up duplicate columns and headers.
3. Manually uploading the CSV to your email tool and mapping fields again.
4. Dealing with duplicate contacts and broken imports.

### How Mailofly Helps

With Mailofly's native Google Sheets integration:

* **No manual file handling**: Connect once, and sync contacts with a single click or on an automated schedule.
* **Smart header detection**: Automatically identifies `email`, `first_name`, `last_name`, and `phone` regardless of capitalization or spacing.
* **Preserve custom attributes**: Any additional columns (e.g. `company`, `source`, `tier`) are saved as custom fields for email personalization (`{{custom.company}}`).
* **Automatic deduplication**: Existing contacts are updated seamlessly without duplicating subscribers.
* **Targeted segments**: Route different sheets or sheet tabs into specific audience segments (e.g., "Webinar Leads", "Early Adopters").

***

## How It Works

```mermaid theme={null}
flowchart LR
    A[Google Form / Sheet] -->|Live Submissions| B[Google Sheets Tab]
    B -->|Public CSV Export| C[Mailofly Sync Engine]
    C -->|Header Matching| D[Field Normalizer]
    D -->|Upsert Contact| E[(Mailofly Contacts)]
    E -->|Tag & Group| F[Target Audience Segment]
    F -->|Instant Dispatch| G[Broadcast Campaign]
```

1. **Spreadsheet Ingestion**: Mailofly fetches the live data stream using Google Sheets' public CSV export.
2. **Column Normalization**: The sync engine inspects the first row to detect email and identity headers.
3. **Contact Upsert**: For each row, Mailofly creates a new contact or updates existing records.
4. **Segment Association**: Synced contacts are automatically linked to your chosen audience segment.

***

## Step-by-Step Tutorial

### Step 1: Format Your Google Sheet

1. Open your Google Sheet in your web browser.
2. Ensure the first row contains clear column headers. At minimum, you must include an **email** column:

| email                                         | name         | phone        | company   | plan       |
| --------------------------------------------- | ------------ | ------------ | --------- | ---------- |
| [alex@example.com](mailto:alex@example.com)   | Alex Rivers  | +15551234567 | Acme Corp | Enterprise |
| [jordan@startup.io](mailto:jordan@startup.io) | Jordan Smith | +15559876543 | Cloudify  | Pro        |
| [taylor@domain.com](mailto:taylor@domain.com) | Taylor Reed  | +15555550199 | Beta Labs | Starter    |

3. Note the sheet tab name at the bottom of the screen (e.g., `Sheet1` or `Leads`).
4. In the top-right corner of Google Sheets, click **Share**.
5. Under **General access**, change the setting to **"Anyone with the link can view"**.
6. Click **Copy link**.

<Tip>
  The sheet only needs **Viewer** permissions. Mailofly never asks for edit access or credentials.
</Tip>

***

### Step 2: Connect Your Sheet in Mailofly

1. In your Mailofly dashboard, go to **[Integrations](https://www.mailofly.com/user/integrations)**.
2. Click on the **Google Sheets** integration card.
3. Click the **Connect Sheet** button.
4. Fill in the connection form:
   * **Target Segment**: Select an existing audience segment, or click **Create new segment…** (e.g., `Google Sheet Leads`).
   * **Google Sheet URL**: Paste the shareable URL you copied in Step 1.
   * **Sheet Tab Name**: Enter the exact tab name (default: `Sheet1`).
5. Click **Add connection**.

***

### Step 3: Run the Initial Sync

1. On the Google Sheets integration page, locate your new connection.
2. Click the **Sync now** button in the connection's action menu.
3. Once the sync finishes, the **Last synced** timestamp will update, displaying the count of imported contacts.
4. Head over to **[Contacts](https://www.mailofly.com/user/contacts)** or **[Segments](https://www.mailofly.com/user/segments)** to inspect your imported subscribers.

***

### Step 4: Send a Campaign to the Synced Segment

Now that your contacts are in Mailofly, sending a broadcast is effortless:

1. Navigate to **[Broadcasts](https://www.mailofly.com/user/broadcasts)** and click **New Broadcast**.
2. Select your synced segment (e.g. `Google Sheet Leads`) as the recipient audience.
3. Personalize your message using both standard and custom attributes:

```html theme={null}
<p>Hi {{first_name}},</p>
<p>Thanks for expressing interest from {{custom.company}}!</p>
<p>We're excited to help your team get the most out of Mailofly.</p>
```

4. Review the preview and click **Send Broadcast**.

***

### Step 5: Automate Background Syncs (Optional)

To keep your Google Sheet contacts constantly in sync without having to click "Sync now" manually, configure a recurring cron job or webhook trigger:

```bash theme={null}
curl -X POST https://app.mailofly.com/api/integrations/google-sheets/sync \
  -H "x-google-sheets-sync-secret: YOUR_CRON_SECRET"
```

You can trigger this endpoint from GitHub Actions, AWS EventBridge, Zapier, or a simple cron service every hour or night.

***

## Header Mapping Reference

Mailofly automatically normalizes standard column names:

| Standard Header       | Supported Variants                                          |
| --------------------- | ----------------------------------------------------------- |
| **Email** (Required)  | `email`, `email_address`, `contact_email`, `mail`, `e-mail` |
| **First Name**        | `first_name`, `firstname`, `first`, `given_name`, `fname`   |
| **Last Name**         | `last_name`, `lastname`, `last`, `surname`, `lname`         |
| **Full Name**         | `name`, `full_name`, `fullname`, `contact_name`             |
| **Phone**             | `phone`, `mobile`, `tel`, `phone_number`                    |
| **Custom Properties** | Any other column (saved to contact `custom_fields`)         |

***

## Next Steps

* [Google Sheets Integration Docs](../../integrations/google-sheets) — Full integration documentation and error codes.
* [Audience Segments Guide](../../audience/segments) — Learn how to create dynamic filters and segment criteria.
* [Campaign Composer Guide](../../broadcasts/broadcast-editor) — Design high-converting emails with the drag-and-drop builder.


## Related topics

- [Google Sheets](/integrations/google-sheets.md)
- [Google workspace](/integrations/google-workspace.md)
- [Integrations](/integrations/index.md)
- [Introduction](/audience/introduction.md)
- [Index](/changelog/index.md)
