Guide

Python for accountants: reconciliations, imports and workflow automation

By Dhruv Dua, Chartered Accountant · Last reviewed

Python is a programming language that accountants use for work that is too large, too repetitive or too error-prone for a spreadsheet: reconciling lakhs of rows, preparing GST and TDS workings and building import files for accounting software. The script reads the source files, applies the same rules every time and writes the result to Excel with control totals, so the work can be re-run and reviewed.

When is Excel enough, and when does Python help?

SituationBetter tool
A one-off working of a few hundred rowsExcel
A model where the reader needs to see and change the formulasExcel
The same working every month from the same reportsPython, with the output in Excel
Files too large or too slow for a spreadsheetPython
Matching two data sets on several conditions, with partial matchesPython
Producing an import file in a fixed formatPython

The output is still an Excel workbook in most cases. Python does the heavy work and Excel remains the place where the client and the reviewer read the result.

What do accountants use Python for?

  • GST input credit reconciliation. Matching the purchase register with GSTR-2B, month by month and registration by registration, and listing the mismatches for vendor follow-up.
  • Receivable and payment matching. Allocating receipts to invoices on a first-in, first-out basis, with part payments, and listing what remains open.
  • Supplier and booking reconciliations. Matching internal records with supplier statements across currencies and identifying open items.
  • TDS workings. Preparing the quarterly statement data from the ledger and checking it against challans.
  • Imports into accounting software. Converting sales, purchase or bank data into the Excel or XML format that TallyPrime and other systems accept.
  • Ledger review. Scanning a full day book for duplicate bills, round-sum entries, entries on holidays and unusual accounts.

How does a finance workflow get built?

The method at Dhruv Dua & Co. is finance first, technology second.

  1. Understand the process. Write down what comes in, who does what, and what goes out. Most delay sits in hand-offs and re-keying.
  2. Remove the friction. Fix the report formats and the naming before writing any code.
  3. Automate what should not be manual. Imports, matching and standard workings go into a script.
  4. Build the review into the output. The workbook carries control totals, an exceptions sheet and a note of the rules applied.
  5. Run it every period. The same script on next month's files gives a comparable result in minutes.

On one engagement, a travel company was reconciling bookings across several suppliers, currencies and internal records by hand. The rebuilt workflow matches bookings across the data sources, lists unmatched and open cases, separates current and future payables and produces supplier-wise and currency-wise reconciliations with management reports.

What makes a Python working reliable enough to sign?

  • Source files are never changed. The script reads copies and writes a new output.
  • Control totals tie. Row counts and rupee totals in equal those out, split between matched and unmatched.
  • Rules are written down. Matching keys, tolerances and the order of matching are stated on a sheet in the workbook.
  • Exceptions are listed. Anything the rules could not resolve goes to a person.
  • The run can be repeated. The same inputs give the same output, so a reviewer can re-perform it.

Does an accountant need to learn to code?

Less than before. AI assistants now write most of the code from a plain-English description of the working. What the accountant must still supply is the rule, the test and the review: what should match what, how to prove the result is complete, and whether the answer makes sense. The division of work between code, AI and the accountant is set out in the guide to responsible AI in accounting.

Which tools are used?

  • pandas for reading and combining tables.
  • openpyxl for writing formatted Excel workbooks with formulas.
  • DuckDB for running SQL on large files held on the computer.
  • Streamlit for a simple screen where a team member uploads the files and downloads the result.

Accounting data can also be read straight from TallyPrime. See the guide to Tally MCP.

Frequently asked questions

Why do accountants use Python?

Accountants use Python for work that is too large or repetitive for a spreadsheet, such as reconciling large data sets, preparing GST and TDS workings and creating import files for accounting software. A script applies the same rules every time and can be re-run each month.

Is Python better than Excel for accounting?

For one-off workings and models that a reader needs to change, Excel is better. For repeated, large or multi-condition matching work, Python is faster and less error-prone. The result is usually still delivered as an Excel workbook.

Can Python be used with Tally?

Yes. Python can prepare Excel or XML import files for TallyPrime and can read data from Tally through its XML gateway.

Does an accountant need to know coding to use Python?

Only a little. AI assistants can write most of the code from a plain-English description. The accountant supplies the matching rules, tests the output with control totals and reviews the result.

How is a Python reconciliation reviewed?

By checking that row counts and totals in equal those out, reading the stated matching rules, examining the exceptions list and re-running the script on the same inputs to confirm it gives the same result.

This guide is general information on the law as it stood on 27 November 2026. It is not advice on a specific transaction.

Talk to a chartered accountant

Tell us what you are working on. The first conversation is an initial view of the matter, without obligation.

Contact the firm