You are helping me build the following AI agent workflow. ## Goal Log LINE Invoice Photos to Google Sheets with OCR: Send an invoice photo to your LINE bot and the agent extracts key fields into a Google Sheet ledger automatically. ## Specification - What it does: Send an invoice photo to your LINE bot to instantly extract details like vendor names and totals into your Google Sheet ledger without manual entry. The agent automatically processes these images using OCR and AI, then appends the data while sending you a confirmation or error message. - Trigger: Triggered by an event (Event ยท on new LINE message) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - LINE Messaging API: Receive invoice photos and send confirmations - OCR.space: Extract raw text from invoice images - Google Gemini Chat Model: Parse key fields like date and total - Google Sheets: Store extracted invoice data as rows ## Known pitfalls, handle each one explicitly in your implementation 1. OCR results often contain typos in dates so add a validation step or let Gemini correct common patterns before parsing. 2. LINE media URLs expire quickly after download so fetch and process the image immediately within the same request flow. 3. Gemini may return malformed JSON if the invoice is too blurry so implement a retry loop with error handling for invalid responses. ## Reference implementation https://n8n.io/workflows/14210 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/log-line-invoice-photos-to-google-sheets-with-ocr/ via usecasesforagents.com