Reconciling GSTR-2B with the Purchase Register using AI, without uploading your client's data
Every month, someone in the office matches GSTR-2B against the purchase register. On a few hundred invoices it's half a day of VLOOKUPs, and the hard part was never the VLOOKUP. It's the exceptions: invoice numbers written differently on each side, a supplier who filed late, an entry posted twice in Tally, a GSTIN with two digits swapped.
AI tools can now do most of this mechanical work. But two questions should come before any CA uses them on a client file: what leaves my laptop, and how do I know the answer is right? This article answers both with a method you can try today on practice data.
The rule: let the AI write the script, not read the data
If you paste a purchase register into a chatbot, every row goes to the provider's servers.
There is a better pattern. Tools such as Claude Code (Anthropic's AI tool that works on files on your own computer) can write a short Python script, run it on your laptop, and show you only the result. The AI sees the column headers, a few sample rows and the totals. The full register is read by the script, on your machine.
This sharply reduces what is sent. It is not a guarantee, because whatever the AI reads or prints does go to the provider. So keep a clean working folder with only the files the job needs, and read each permission prompt before you approve it.
Step 1: Look at the structure, not the data
Start by asking only for the shape of the files:
This folder has two files: purchase_register.xlsx (exported from Tally) and gstr2b_jul-sep.xlsx (GSTR-2B for July to September). Do not read the files in full. Write and run a short Python script that prints, for each sheet of each file: the sheet name, the number of rows, the header rows and the first 3 data rows. Then tell me how the two files line up, and stop.
On a practice run, this step on its own caught three things a junior often misses. The 2B header spans two rows. The Tally export has title rows above the data and a Grand Total line at the bottom. And the 2B shows credit notes as positive amounts on a separate B2B-CDNR sheet, while the books show them as negative.
On a real client, this is where you catch a wrong export (a missing month, no GSTIN column) before anything is built on it.
Step 2: Spell out the matching rules, as you would in an audit programme
The quality of the result depends on the rules you give it. These are the ones that matter:
- Clean invoice numbers before matching: upper case, remove the financial year (2025-26 or 25-26), keep only the digits, drop leading zeros.
- Match in rounds, and record the round: (a) GSTIN + invoice number as written; (b) GSTIN + cleaned invoice number; (c) for what is left, cleaned number + taxable value within ₹1 + dates within 7 days where the GSTIN differs. Round (c) is a probable GSTIN error, not a match.
- Never match on invoice number alone. Each 2B row can pair with only one books row.
- Find duplicates first: the same GSTIN and cleaned invoice number more than once in the books.
- Compare every tax head: taxable value, IGST, CGST, SGST and cess. A difference of ₹1 or less is "within tolerance"; anything more is a mismatch, with the reason.
- Flag, don't decide: GSTINs that fail the check-digit test, and ledger heads that suggest blocked credit under section 17(5) (motor car, club, food, gift, insurance). Eligibility stays your call.
Ask for an output workbook with one sheet per bucket: matched, matched within tolerance, mismatched values, in books not in 2B, in 2B not in books, possible duplicates, and flagged for review.
Step 3: Control totals before conclusions
This is the step that makes the work auditable. Ask for control totals for each input and each output sheet (rows, taxable value, each tax head, total ITC), and for proof that the sheets add back to each input. Tie the books total to the register's own Grand Total line.
On a 358-row practice file with fifteen planted traps, the summary read:
Books: 348 + 3 + 5 + 1 + 1 = 358 rows, and every amount column matches. YES
2B: 348 + 3 + 5 + 2 = 358 rows, and every amount column matches. YES
Every row on each side lands in exactly one sheet. If the totals don't add back, nothing is "matched" yet.
What it found
- Two value mismatches. In one, IGST in the books was ₹5,790 short of 2B. In another, the taxable value differed by ₹27,000.
- Three probable GSTIN errors for one supplier, where two digits of the PAN portion were swapped. The output said "probable GSTIN error, NOT a match" instead of quietly pairing them. That wording matters.
- One invoice in the books but not in 2B (₹49,500 of ITC at risk, a late filer), and two in 2B but not in the books, one of them a supplier credit note.
- One duplicate Tally entry.
- Two possible section 17(5) items: a club membership and a director's motor car, flagged for your judgement.
Step 4: Check it like you'd check an article assistant's work
- Re-add the totals in Excel yourself.
- Pick three exceptions and trace them back to both source files by hand.
- Read the script's matching rules. Change one tolerance and re-run to see the result move.
- Don't edit the output by hand. If something is wrong, fix the rule and re-run, so the working paper matches the script.
What not to hand over
The AI flags; it does not decide. Whether a credit is blocked, whether to reverse ITC, and what to tell the client about a non-filing supplier are professional judgements. Treat any section number or rule the AI quotes from memory as a lead to check against the Act, not as an answer.
Try it on practice data first
Don't start on a live client. I've put together a practice set for this exact exercise: a made-up purchase register and GSTR-2B with fifteen planted traps, an answer key, and a test script that grades your output. It's free to download, along with 100+ prompts for CA work, at topmate.io/chandan_gupta31 (look for the "AI for CAs: Bonus Pack").
Chandan Gupta, CA, CIA, is the author of AI for CAs: A practical guide to Claude Code for tax, audit, advisory and compliance work. Chapter 14 of the book walks through this reconciliation end to end. topmate.io/chandan_gupta31
Independent publication; not affiliated with or endorsed by Anthropic. Not professional advice.
This guide is a short version of Chapter 14 of AI for CAs, which walks through it end to end on practice files.
Want the result without writing a script?
The free GSTR-2B reconciler runs the same matching rules in your browser. Nothing is uploaded.