# Export line items to Google Sheet (workflow)

Export invoice line items to Google Sheets from a workflow step.

Append **one row per line item** (or a wide layout with columns per line) to a Google Spreadsheet when an invoice or expense reaches the **Export line items to Google Sheet** workflow step. Useful for reporting, BI feeds, and audit trails alongside accounting export.

**Who this is for:** Process owners who want structured line-level data in Google Sheets without manual copy-paste, typically after matching or before/after **Export to accounting**.

## 1. Add the step

1. Open **Workflow Configuration** for **Payables** or **Expenses**.
2. From the palette, add **Export line items to Google Sheet**.
3. Place it where you want the export to run (often on a **Synced** branch after accounting export, or on a parallel branch for reporting only).
4. **Publish** the workflow when configuration is complete.

## 2. Configure the node

**Google Drive prerequisite** · Connect **Google Drive** under **Settings → Integrations → Data exchange** and ensure the workspace folder exists. The step uses the Cortena service account (same as guidelines) and writes under **Exports** inside your guidelines folder.

| **Setting** | **What it does** |
| --- | --- |
| **Destination** | Resolves to the tenant **Exports** folder (link opens in Drive) |
| **Spreadsheet filename template** | Name of the spreadsheet; slashes create subfolders under **Exports** (e.g. `2026/Q1 line export`) |
| **Sheet tabs** | **Append to the first tab** · single sheet grows over time; **One tab per month** · tab name `YYYY-MM` from invoice date (UTC) |
| **Line items layout** | **One row per line item** (default), or **One row per invoice** with each line as a block of columns (name, quantity, net, VAT %, line total, booking account, BU/VAT code). Wide layout supports up to **40** lines per invoice |

Use the variable chips to copy placeholders (invoice number, dates, supplier, amounts, etc.) into the filename template.

## 3. What happens when the step runs

When the workflow reaches this node, Cortena:

1. Builds rows from the invoice’s **line items** and header fields.
2. Creates or opens the target spreadsheet under **Exports**.
3. Appends rows (idempotent per line so re-runs do not duplicate the same line key).
4. Writes an **Activity** entry on the invoice with success, failure, or a link to open the sheet.

If Google Drive is not connected or the folder is missing, the step fails with a clear configuration message on the node.

## 4. Common workflows

1. **Monthly reporting** · **Sheet tabs** = one tab per month; filename includes `{{invoice_date_yyyy}}`.
2. **Post-export audit** · **Export to accounting** → **Synced** → **Export line items to Google Sheet** → **Set invoice status**.
3. **Wide export for finance** · One row per invoice when reviewers prefer horizontal line blocks in Excel/Sheets.

## Tips and limitations

- Requires **Google Drive** data exchange; not a personal “My Drive” upload from the user’s account.
- Wide layout fails with an explicit error when an invoice has more than 40 lines.
- Available for **invoice** and **expense** workflows.
- For PDF archival (not line grids), use [Send document to Google Drive](https://help.cortena.ai/guides/workflows/send-to-google-drive) instead.

## Quick reference

| **Task** | **Where** |
| --- | --- |
| Connect Drive | **Settings → Integrations → Data exchange** |
| Add step | **Workflow Configuration** → **Export line items to Google Sheet** |
| Output location | Workspace **Exports** folder (under guidelines root) |
| Confirm run | Invoice **Activity** → Google Sheets export entry |
| Open sheet | Link in Activity or **Exports** in Drive |
