Skip to content
TriedPrompts

More in Bookkeeping, receipts & invoices.

Automate supplier invoice PDFs into ERP exports with Gemini and Apps Script

PartialEvidence: Described by posterPosted Last checked

Asaf Lecht's Gemini Apps Script cut invoice batches to a 5-minute review, but Gemini invented dates until validation.

How to use this

  1. Tap Copy prompt.
  2. Open Gemini.
  3. Paste it into the message box.
  4. Send it, then read the answer before acting on it.
New to this? What's a prompt?

A prompt is the message you send to the AI tool. Copy the one on this page, put your own details where it asks, and read the answer before you act on it.

Prompt

Recreated prompt

The source didn't share its exact prompt, so we wrote one from what it describes. The result shown is the source's, not ours.

What the prompt labels mean

The person didn't share their exact words, so we wrote this from what they described. We haven't tested it, and they didn't use this exact version.

Design an Apps Script pipeline that watches a Drive inbox of supplier invoice PDFs, uses Gemini to extract structured fields, escalates to a stronger model when confidence is low or dates look wrong, writes rows to a Sheet, and exports the exact tab-delimited ERP format. Handle multi-invoice PDFs and checkpoint/resume before the 6-minute limit.

Try this in:

Sends the Recreated prompt shown above. ChatGPT and Grok open with it filled in, and ChatGPT may send it straight away. Gemini and Claude open empty, so we copy the prompt for you to paste. Every button also copies it.

Opens in a new tab. We don't see what you send.

These links are only a shortcut. We're not affiliated with OpenAI, Google, Anthropic or xAI, and your results may not match the source.

Optional stronger version

Our rewrite with extra checks. The poster didn't test it.

Before you start, ask me 1–3 short questions about the details below and wait for my answers. Once I've answered, confirm the plan in one line and run the whole task start to finish.

Goal: Automate supplier invoice PDF intake into validated Sheet rows and ERP export files.

Questions to ask me first:
- What fields and date formats does the ERP require?
- Where do PDFs land, and how many arrive per week?
- Which model should run first, and when should we escalate?

Inputs (fill in or confirm):
- Drive inbox folder: [ID]
- Sheet schema: [COLUMNS]
- ERP export rules: [FORMAT]
- Sample PDFs: [FILES]

Rules:
- Validate dates against plausible ranges; re-extract on suspicion.
- Detect and split multi-invoice PDFs.
- Save both model responses when escalating.
- Checkpoint before Apps Script timeouts.

Checkpoint: Run five sample invoices and show extraction accuracy before enabling the watcher.

If you get stuck: If Hebrew RTL breaks the review UI, isolate layout fixes from extraction logic.

Verify before you finish: Diff ERP export bytes against a known-good import file before go-live.

Output: Architecture notes, Apps Script outline, validation rules and a sample review workflow.

Done when: Accounting can review in minutes instead of retyping every PDF.

AI tool

Gemini

Outcome

Asaf Lecht built a Google Apps Script system for a client's accounting team that spent 15–30 minutes per supplier invoice PDF. A file watcher feeds Gemini for structured extraction, escalating from a fast model to a larger one when confidence is low; results land in Sheets and ERP export files, with a Hebrew review dashboard. Flash handled about 85% of invoices; harder ones auto-escalated. Challenges included multi-invoice PDFs, Gemini inventing dates (fixed with validation ranges and re-extraction), Hebrew RTL layout, Apps Script's 6-minute limit (checkpoint/resume), and a strict ERP format. The client moved from about 30 minutes per batch to a 5-minute review workflow.

Evidence: Described by posterThe person describes what happened in words, without screenshots or video.

Known limitations

PartialThe source says it only partly worked, or had a significant problem a person had to deal with.

What went wrong: Automation cut batches to about a 5-minute review, but Gemini sometimes fabricated dates until validation and model fallback were added.

Source

Posted
by Asaf Lecht
Last checked
Method:
How we verify

https://seithx.github.io/2026/05/05/automating-invoices-with-apps-script-and-gemini.html

Context: Built for a client accounting team; firsthand builder report. En dash used for the 15–30 minute range.

More in Bookkeeping, receipts & invoices