Skip to content
IN-DEPTH TUTORIAL / 05

Invoice and receipt organization: deduplication and currency totals

Use eight synthetic text extracts to practice month boundaries, duplicate identity, missing amounts and separate currency totals before connecting email or spreadsheets.

Prepared by shancha6 stages · Complete prompts6 practice files
On this page
  1. Inputs and complete outputs
  2. Preparation and capabilities
  3. Execution and takeover boundaries
  4. 01 Agree period and date basis
  5. 02 Extract fields without repairing unknown values
  6. 03 Find duplicates and retain every original
  7. 04 Reconcile by currency and account for exceptions
  8. 05 Review CSV before deciding on an append
  9. 06 Keep review queues and handle late arrivals
  10. Troubleshooting and acceptance
  11. Download practice files
  12. Sources and verification scope
THE RESULT

Check the input, then compare the complete deliverables

Explore the original materials, item-by-item outcomes and full report below. Attempt the input independently before using the reference to find omissions or disagreements.

Demonstration scope

These are synthetic text extracts, not verified invoices or PDF/OCR tests. No inbox read, voucher upload, sheet write or payment occurred.

Invoice and receipt organization practice
8 synthetic extracts · 2 currencies

Original synthetic material. Try the input independently, then compare the reference results.

Original receipt text
IN01 | mail-A/attachment-1
Invoice C100, Example Cloud, 2026-09-10, CNY 120.00, Paid.

IN02 | mail-B/attachment-2
Forwarded invoice C100, Example Cloud, CNY 120.00, Paid.

IN03 | mail-C/attachment-3
Receipt U200, Example Design, 2026-09-12, USD 20.00, Paid.

IN04 | mail-D/attachment-4
Bill C180, CNY 80.00, Unpaid.

IN05 | mail-E/attachment-5
Receipt C190, 2026-09-20, Paid, CNY; amount text illegible.

IN06 | mail-F/attachment-6
Invoice C150, CNY 50.00, Void.

IN07 | mail-G/attachment-7
Receipt C199, 2026-10-02, CNY 99.00, Paid.

IN08 | mail-H/attachment-8
Receipt C130, Example Messaging, 2026-09-28, CNY 30.00, Paid.
Period and filing rules
Include unique paid, nonvoid, known-amount invoices dated 2026-09-01 inclusive to 2026-10-01 exclusive. Match vendor+invoice number+currency for duplicate candidates, then verify amount/date; conflicting keys need human review. Retain originals and sources. Total currencies separately without FX. Keep unpaid, unknown, void and out-of-period queues. Escape formula-like CSV text; write spreadsheet values as raw text.
This shows complete inputs and expected outputs. Switching tabs runs no task; verify real connections and writes separately in your environment.
BEFORE YOU START

Prepare the materials and check your tools

Start with the practice files

  • Extract eight inputs before viewing answers.
  • Use invoice date for September, not email receipt date.
  • No authentic originals are supplied; validity/amounts need human review.

Before using real services

  • Specify mailbox, period, attachment types and limit.
  • Check attachment reading, file storage and Sheets append; fall back to local CSV.
  • Review financial-file visibility before shared storage.

Complete one file-based exercise first. For real services, verify the actual account, available tools and operation scope, then follow the acceptance check at each stage.

Download the original input and rules ↓
EXECUTION & TAKEOVER

Execution and takeover boundaries

The actions below require the agreed inputs, accounts and scope. Configuring a Routine does not expand that authorization.

Can run automatically

Organize supplied invoice text extracts; check amounts, currencies, payment status and duplicates in a proposed archive list.

Requires confirmation

Confirm real attachment access, Drive destinations, names, overwrites and moving or deleting originals. Filing does not authorize payment.

Take over after a failure

Preserve originals and exceptions for unclear OCR, amounts or upload state. Deduplicate by original message, attachment and target file; manually inspect before retrying uploads.

STEP 01

Agree period and date basis

Invoice, payment and email receipt dates can assign different months. This exercise uses invoice date, September 1 inclusive toOctober1 exclusive.

Separate receipts, unpaid bills, void invoices and refunds. A register is not authenticity verification.

Stage 01 · Agree period and date basis
Read source-invoices.json and filing-rules.md only. Restate period, date basis, inclusion, deduplication and missing-value rules. Index all 8 ids/sources. Do not read real email, connect Sheets, pay or upload material.
Expected output

Eight source records with clear boundaries.

Acceptance check

IN07 is excluded by October invoice date, not email timing.

STEP 02

Extract fields without repairing unknown values

Retain vendor, number, date, amount string, currency, state and source. Unknown amount remains null with a reason.

PDF pagination, rotation, tax and OCR have not been tested; real attachments need source checks.

Stage 02 · Extract fields without repairing unknown values
Extract source_id, vendor, invoice number, date, amount string, currency, paid/void state, source and gaps for 8 extracts. Keep unknowns null. Infer no FX, tax or illegible digit. Save extracted.json before reading answers.
Expected output

Structured source-preserving records.

Acceptance check

IN05 amount remains null; IN04/IN06 do not become valid paid receipts.

STEP 03

Find duplicates and retain every original

Different filenames may contain one invoice; the same name may refer to different documents. Compare business keys and then amount/date.

Conflicts or missing numbers require review, not silent replacement or deletion.

Stage 03 · Find duplicates and retain every original
Identify duplicate candidates with primary record, duplicate sources, matching fields and evidence. Link IN02 to IN01 while retaining both. Flag same-key amount/date conflicts. Delete no attachments or originals. Save dedupe.csv.
Expected output

A duplicate relation excluding IN02 from totals.

Acceptance check

All 8 originals remain; retained-file and unique-total counts differ.

STEP 04

Reconcile by currency and account for exceptions

Filter period, paid, nonvoid, known amount and uniqueness before totals. Use integer minor units or reliable decimal arithmetic.

Every excluded source needs a destination and reason.

Stage 04 · Reconcile by currency and account for exceptions
Total eligible unique records by currency using minor units. Return ids, count, total per currency and separate unpaid, review, void, outside-period, duplicate queues. No FX or mixed-currency total; unknown is not 0. Account for all 8 inputs.
Expected output

CNY 150.00, USD 20.00; 3 paid and 5 other outcomes.

Acceptance check

No combined 170; all queues reconcile to 8 inputs.

STEP 05

Review CSV before deciding on an append

Formula-like vendor/notes text must not execute in a spreadsheet. Keep source values traceable.

Sheets append does not deduplicate business keys; verify target, existing keys and readback.

Stage 05 · Review CSV before deciding on an append
Produce a local register CSV with formula-triggering text escaped and original values traceable. Only after later approval of a specific sheet/range, check keys, append confirmed new records in raw-value mode, record range and read back. Without tools return CSV; no Drive upload, history edits or payments.
Expected output

A local register; actual append evidence only if later authorized.

Acceptance check

Reruns do not duplicate invoices; a file is not claimed as an online write.

STEP 06

Keep review queues and handle late arrivals

Preserve unreadable amount sources, duplicate links and exclusion reasons for reviewed revisions.

A monthly run needs time zone, period logic and a late-invoice policy without silent historical rewrites.

Stage 06 · Keep review queues and handle late arrivals
Draft an invoice-register Skill with month boundaries, fields, deduplication, currency arithmetic, gaps, outputs, review and revisions. Default local files. Propose monthly Routine only with late-arrival rules. Do not automatically authorize writes, uploads, payments, external delivery or Bot contact.
Expected output

A reusable method and review queue.

Acceptance check

Reruns/backfills are recorded without overwriting originals or confirmed history.

TROUBLESHOOTING & ACCEPTANCE

Find the evidence before choosing the next action

Same number, different amount

Flag conflict and inspect original/vendor/version; do not choose the newest silently.

Amount or currency unreadable

Keep null, source and reason; exclude from totals pending review.

Multiple currencies appear

Total separately; any future FX requires an agreed source, date and precision.

Append timed out

Read the target by business key before retrying.

An old invoice arrives late

Use the agreed date basis and a dated backfill revision.

Check every item before finishing

These page-local checkboxes reset on refresh. Checking them does not verify a real service connection.

Checked 0 / 6 items

PRACTICE MATERIALS

Download the inputs separately from the reference answers

Start with input and rules without showing the reference answers. After acceptance, save the report and complete prompt set.

SOURCES & VERIFICATION

Check documented capabilities and exercise results separately

Content updated: · Editing a page does not reverify its sources or live workflow.

Documentation review: Unverified · no review date recorded
No case-specific documentation review is recorded. References below are provided for review and do not establish verification.

Live workflow verification: Unverified
Live accounts, external writes, scheduled execution and long-term operation are unverified. Synthetic exercises and page checkboxes do not establish live verification.

These are synthetic text extracts, not verified invoices or PDF/OCR tests. No inbox read, voucher upload, sheet write or payment occurred.

  1. Gmail API: get message attachments ↗

    Identify the exact attachment. This exercise uses text extracts and does not retrieve real attachments.

  2. Google Sheets: append values ↗

    Appending does not deduplicate business records. Verify the target range and read back actual writes.

  3. Grok Bot: apps and the shared computer ↗

    Check connected accounts, available tools, visibility and user takeover.

  4. Grok Bot: Skills and Routines ↗

    Validate a manual run before saving a method or scheduling it.

NEXT STEP

Try another small batch of your own material

Retain original input and operation records. Verify that each result can be traced before adding connections or recurring runs.

217 related external resources →Official sources and original authors’ posts, each with a note on what was checked.

Last updated: