---
name: gmail-invoices-and-receipts
description: "Every weekday evening: invoices and receipts that arrived in Gmail this month, logged as rows in a Google Sheet with vendor, date, amount and status. Use when the user asks for this, or when it runs on a schedule."
---

# Gmail invoices and receipts to Google Sheets

Every weekday evening: invoices and receipts that arrived in Gmail this month, logged as rows in a Google Sheet with vendor, date, amount and status.

Month end starts with your bookkeeper asking for receipts and you searching Gmail for "invoice" across thirty vendors who all word it differently. Half the amounts are in a PDF and two are in euros.

This skill keeps the list current as the month goes. Every weekday it finds new invoices and receipts, reads the vendor, date, amount and number from the email or the attached PDF, and appends one row per document to a sheet your bookkeeper can open. Each row carries the Gmail message ID, so nothing is logged twice.

## Two ways to get the data

Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.

## Route A: API or MCP server

### What you need

- Gmail read access (`gmail.readonly`) through a connector, an MCP server or a Google OAuth client.
- Edit access to the bookkeeping sheet for the same Google account or a service account, and the spreadsheet ID.

If something is missing, say what and stop; do not invent numbers.

### Steps

1. **Search this month's mail** (Gmail): Call `users.messages.list` with the query `after:2026/10/01 (invoice OR receipt OR "payment received" OR "order confirmation") -in:sent -in:chats`, using the first of the current month, plus `has:attachment filename:pdf` for the same dates.
2. **Skip what is already logged** (Google Sheets): Read the Message ID column with `spreadsheets.values.get` on `Receipts!H:H` and drop every message already in it.
3. **Read each document** (Gmail): Take the vendor from the `From` display name or domain, then the date, amount, currency, invoice or receipt number and paid or due from the body. When the amount is only in the PDF, fetch it with `users.messages.attachments.get` and read the text.
4. **Append the rows** (Google Sheets): Call `spreadsheets.values.append` on `Receipts!A:H` with `valueInputOption=USER_ENTERED`, one row per document: Date, Vendor, Description, Amount, Currency, Number, Status, Message ID.
5. **Report**: New rows today, the month's count and total per currency, unpaid invoices with their due dates, and any document whose amount couldn't be read.

## Route B: the browser

### What you need

- Signed in to Google in the browser with the mailbox open, and Editor access to the bookkeeping sheet on the same account.

If something is missing, say what and stop; do not invent numbers.

### Steps

Start at https://mail.google.com/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.

1. **Search this month's invoices**: In Gmail search `after:2026/10/01 (invoice OR receipt OR "payment received" OR "order confirmation") -in:sent -in:chats` with the first of the current month, then a second search `after:2026/10/01 has:attachment filename:pdf -in:sent`.
2. **Open the sheet and check what is logged**: In a second tab open the bookkeeping sheet from https://docs.google.com/spreadsheets/ and the `Receipts` tab. Column H holds the Gmail message ID; for each email, open it, click the three-dot menu, **Show original**, and compare the `Message-ID` line against column H. Skip matches.
3. **Read each new document**: Take the vendor from the sender, then the date, amount, currency, invoice or receipt number and paid or due from the body. When the amount is only in the PDF, click the attachment to preview it in Gmail and read it there.
4. **Add the rows**: In the sheet, click the first empty row under the data and type one row per document: Date, Vendor, Description, Amount, Currency, Number, Status, Message ID. Press Enter after each cell; Sheets saves as you go.
5. **Report**: Rows added today, the month's count and total per currency, unpaid invoices with due dates, and any document whose amount could not be read, with its subject line.

Note: Typing rows into Sheets in the browser is slow: fine for a handful of documents a day, a stopgap for a backlog of a hundred. The Message-ID header from Show original is not the same string as the Gmail API message ID the API route logs, so pick one route for a given sheet or keep both in column H. Scanned PDFs with no text layer cannot be read in the preview either.

## The report

- **New rows** added today, and the month's running count and total per currency.
- The new documents: date, vendor, amount, paid or due.
- Unpaid invoices with their due dates.
- Documents without a readable amount, with a link to the email.

## Post it to Briefkin

When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.

```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
  -H "authorization: Bearer $BRIEFKIN_TOKEN" \
  -H "content-type: application/json" \
  -d @- <<'JSON'
{
  "v": 1,
  "event_id": "gmail-invoices-and-receipts/<date of this run, e.g. 2026-10-16>",
  "item_key": "gmail-invoices-and-receipts",
  "project": "Acme",
  "source": "Gmail invoices and receipts to Google Sheets skill",
  "kind": "update",
  "title": "18 invoices and receipts logged for October",
  "summary": "**5** new rows today and **18** this month, totaling **$7,412.36**. One invoice is still unpaid.",
  "widget": [
    {
      "type": "Table",
      "props": {
        "columns": [
          "Date",
          "Vendor",
          "Amount",
          "Status"
        ],
        "align": [
          "left",
          "left",
          "right",
          "left"
        ],
        "rows": [
          [
            "Oct 16",
            "AWS",
            "$1,284.17",
            "Paid by card"
          ],
          [
            "Oct 16",
            "Google Workspace",
            "$432.00",
            "Paid by card"
          ],
          [
            "Oct 15",
            "Notion",
            "$96.00",
            "Paid by card"
          ],
          [
            "Oct 15",
            "Oakridge Coworking",
            "$650.00",
            "Paid by transfer"
          ],
          [
            "Oct 15",
            "M. Ito Design",
            "$1,800.00",
            "Due Oct 30"
          ]
        ]
      }
    },
    {
      "type": "Callout",
      "props": {
        "text": "M. Ito Design invoice #0042 for $1,800.00 is due Oct 30 and not paid yet.",
        "tone": "info"
      }
    }
  ]
}
JSON
```

Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.

## Run it on a schedule

Suggested: Weekdays at 18:00 (`0 18 * * 1-5`). From cron, with the agent signed in on that machine:

```bash
0 18 * * 1-5 claude -p "Run the gmail-invoices-and-receipts skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```

Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/gmail-invoices-and-receipts#schedule

Source: https://briefkin.dev/skills/gmail-invoices-and-receipts
