Google Sheets
Lantfly can write to a Google Sheets spreadsheet automatically:
Kind (kind) | What it writes | When |
|---|---|---|
run | The items of the run's default dataset (hidden #fields left out). Optional filter on an actor or a task. | After every matching run that succeeded. |
listening | New visible mentions of a listening project, one row per mention, updated in place by id. | Every minute. |
listening with include_kpis | One row of yesterday's KPIs (in the project's time zone) to a second tab: date, project, new_mentions, views, likes, comments, shares, engagement, positive, neutral, negative, updated in place by date. | Once a day. |
Lantfly writes with its own Google service account. You share the spreadsheet with it; Lantfly never asks for your Google credentials.
Set up an export
- In the Console, open Integrations → New Google Sheets export. The page shows Lantfly's service account email.
- In Google Sheets, click Share and add that email as Editor.
- Back in Lantfly, paste the spreadsheet link (or its ID), pick a tab name, and choose what to export:
- Run results: optionally only one actor or one task.
- Listening: the project, and whether to add the daily KPI row. Turn on Include existing to also export the mentions found before today (default: only new ones).
- Prove the spreadsheet is yours. The export shows a tab name like
lantfly-ab12cd. Add a tab with exactly that name to the spreadsheet. You can delete it after the next step. - Click Check access. Lantfly opens the spreadsheet, finds the verification tab, creates your export tab if it is missing and writes the header row. Google's error (not shared, not found) is shown with a hint when something is wrong.
- Click Export now to send the first rows, or wait for the next run or mention.
Every customer shares spreadsheets with the same service account. The verification tab proves that the person creating the export can edit the spreadsheet. Nothing is written until the export is verified; mentions found in the meantime are exported once it is. Changing the spreadsheet of an export asks for verification again. A spreadsheet can be connected to one Lantfly account only.
Columns and updates
- Columns (
fields) are item paths;a.breads a nested value. Empty: for runs, the keys of the items; for listening, the default mention columns (id,platform,kind,published_at, the author,text,url, the counts,sentiment,hashtags,first_seen_at,is_ad…). - Lantfly follows the header row in the sheet: you can reorder columns or add your own. Missing fields are added at the end of the header, and your own columns are never overwritten.
- Upsert key (
upsert_key): a row whose cell in this column matches is updated instead of appended. Listening exports useid. Empty: rows are only appended. - Row cap (
max_rows): rows one export may write at a time. Extra rows are skipped and reported on the export. - Values are written as plain values, never as formulas: scraped text like
=IMPORTXML(...)stays text. Cells longer than 49,000 characters are cut. - A run is exported once per export. Export now can send it again.
Delivery and errors
- Rate limits, Google server errors and lost connections are retried after 1, 5, 25, 125 and 625 seconds.
403(not shared),404(wrong ID) and400fail at once.- The last error shows on the export list and its page, and you get an
integration.failingnotification (at most once a day per export).
API
| Endpoint | Use |
|---|---|
GET /api/v3/integrations/google-sheets/service-account | { configured, email }: the email to share with. |
GET /api/v3/integrations/google-sheets | Your exports, each with its last delivery. |
POST /api/v3/integrations/google-sheets | Create an export. |
GET /api/v3/integrations/google-sheets/{integration} | One export with its last 50 deliveries. |
PATCH /api/v3/integrations/google-sheets/{integration} | Update it (kind cannot change). |
DELETE /api/v3/integrations/google-sheets/{integration} | Delete it. |
POST /api/v3/integrations/google-sheets/{integration}/test | Check access: verification tab, export tab, header row. |
POST /api/v3/integrations/google-sheets/{integration}/sync | Export now: the latest matching succeeded run, or the new mentions (and the KPI row when due). |
curl -X POST "https://lantfly.com/api/v3/integrations/google-sheets" \
-H "Authorization: Bearer $LANTFLY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Web scraper results",
"kind": "run",
"spreadsheet": "https://docs.google.com/spreadsheets/d/<spreadsheetId>/edit",
"sheet_name": "Results",
"condition": { "actor_id": "<actorId>" },
"fields": ["url", "title", "loadedAt"],
"upsert_key": "url"
}'
The answer has verification_tab. Add that tab to the spreadsheet, then:
curl -X POST "https://lantfly.com/api/v3/integrations/google-sheets/<integrationId>/test" \
-H "Authorization: Bearer $LANTFLY_TOKEN"
| Field | Meaning |
|---|---|
name | Name of the export. |
kind | run or listening. |
spreadsheet | Spreadsheet URL or ID (on create and update). |
sheet_name | The tab; created when missing. No [ ] * ? / \ :. |
condition | run only: actor_id and/or task_id. |
project_id | listening only, required. |
fields | Columns. |
upsert_key | Column to update rows by. |
max_rows | Rows one delivery may write. |
include_kpis, kpi_sheet_name | listening: the daily KPI row and its tab (default <sheet_name> KPI). |
include_existing | listening, on create: also export existing mentions. |
is_enabled | Turn the export off without deleting it. |
Creating and changing exports needs the permission to manage automations in an organization, and access to the project for listening exports.