DEV Community

Stackscale
Stackscale

Posted on

Extract Invoice Data to Google Sheets with Make and OpenAI

If you want to extract invoice data to Google Sheets without opening a single PDF, one no-code Make scenario can do the whole job for you. Gmail watches for new invoice PDFs, OpenAI pulls out the vendor, date, invoice number and total, and every line lands in Google Sheets — no typing, no code.

What you need

  • A Gmail account that receives invoices
  • A free Make account
  • An OpenAI account
  • A Google Sheet with headers for vendor, invoice number, date, due date, and total

Disclosure: Some links below are affiliate links, meaning StackScale may earn a commission at no extra cost to you.

Get started with Make here: https://www.make.com/en/register?pc=stackscale&affiliateSource=devto

The workflow in four modules

  1. Gmail watch emails — the trigger, filtered to invoice PDFs with attachments.
  2. Gmail get attachment — pulls the PDF out of the email as binary data.
  3. OpenAI chat completion — reads the invoice and returns only structured JSON.
  4. Google Sheets add a row — logs one row per invoice.

Step 1: Set up the Gmail trigger

In Make, create a new scenario and add the Gmail module, watch emails. Connect your Gmail account and set the filter to messages with attachments, and only those whose subject or sender looks like an invoice. That filter is what keeps personal mail out of your books.

Step 2: Get the PDF out of the email

Add the Gmail get attachment module, and use an iterator if an email carries more than one file. Pass the file to the next step as binary data. This is the step people skip, and it is the step that breaks the whole flow when it is missing.

Step 3: Let OpenAI read the invoice

Add the OpenAI module, create a chat completion, and give it a strict instruction: read the attached invoice and return only JSON with vendor, invoice number, invoice date, due date, currency, and total amount. No extra words, no explanation. Structured output means Make can read the answer without guessing.

Example of the JSON OpenAI should return (dummy data):

{
  "vendor": "Acme Supplies Ltd",
  "invoice_number": "INV-2026-1042",
  "invoice_date": "2026-11-03",
  "due_date": "2026-12-03",
  "currency": "USD",
  "total_amount": 184.5
}
Enter fullscreen mode Exit fullscreen mode

Step 4: Log one row per invoice in Google Sheets

Add the Google Sheets module, add a row. Map each JSON field to a column like this:

JSON field Sheet column
vendor Vendor
invoice_number Invoice number
invoice_date Date
due_date Due date
total_amount Total

One row per invoice, in the order they arrive. Set up the sheet once with those exact headers, and the scenario fills it forever.

Step 5: Test with dummy data first

Before you switch it on, send yourself a test invoice PDF — a made-up vendor, a made-up total — and run the scenario once. Check the row appears in Sheets with the right numbers. If OpenAI misreads a field, tighten the prompt and run it again.

The habit that makes it work

Once a week, open the sheet and scan the totals column. Anything that looks wrong gets checked against the original PDF, which Gmail still holds. The automation does the typing; you do the ten-minute check.

Watch the full tutorial above. New automation tutorial every day on the StackScale YouTube channel.

Top comments (0)