Skip to content
TriedPrompts

More in Build apps & tools.

Fix year-routing in a Gemini tax-invoice script with Claude Code

WorkedEvidence: Described by posterPosted Last checked

Waldo used read-only Claude Code to replace brittle year if/else routing in a Gemini invoice Apps Script with FOLDER_MAPPING.

How to use this

  1. Tap Copy prompt.
  2. Open the tool the case used (or a similar one) and paste the prompt; results may differ from the original.
  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.

Review this Apps Script tax-invoice project in read-only mode. Fix the year-routing logic that archives files with a chain of if (year === 2026) else if (year === 2025). Reuse existing config such as FOLDER_MAPPING instead of duplicating year checks, and explain the change before I apply it.

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: Patch my tax-invoice automation safely without giving the model write access to real financial data.

Questions to ask me first:
- Which folders and sheet IDs are already in config?
- What should happen for a new calendar year not yet mapped?
- Which permissions stay denied (Drive write, API send, MCP)?

Inputs (fill in or confirm):
- Project path: [PATH]
- FOLDER_MAPPING / CONFIG: [FILE]
- Failing behavior: [YEAR ROUTING BUG]

Rules:
- Stay read-only until I approve a diff.
- Prefer config-driven routing over hard-coded years.
- Don't connect MCP to production Drive or Sheets.
- Keep script_log behavior intact.

Checkpoint: Propose the patch and show which config keys it uses before I apply anything.

If you get stuck: If folder IDs are missing for a year, ask me to add a config entry rather than inventing IDs.

Verify before you finish: Trace one sample invoice date through the new routing in a dry explanation.

Output: A focused patch explanation, the config change, and test steps I can run myself.

Done when: Year routing works from config and the model never wrote to production.

AI tools

Claude CodeGemini

Outcome

Waldo Vanderhaeghen had a Google Apps Script that sent tax invoice PDFs to Gemini for JSON extraction into Sheets. After seven versions with MD5 deduplication, vendor rules, quarantine and verification, chat-based fixes kept losing architecture context. Waldo switched to Claude Code in read-only mode (no Drive writes, no API calls, no MCP to production data) so the model could read the whole project. When asked to fix year-routing that used a brittle if/else chain of years, Claude Code reused an existing FOLDER_MAPPING config instead of duplicating logic. Waldo's takeaways: prefer deterministic rules over model categorization, keep a script_log audit trail, and default to read-only for financial automation.

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

Source

Posted
by Waldo Vanderhaeghen
Last checked
Method:
How we verify

https://waldo.vanderlore.de/blog/tax-flow-claude-code/

Context: Recreated from the year-routing example. Original extraction still uses Gemini; Claude Code was used for codebase fixes.

More in Build apps & tools