From Inbox to Books: Automating Invoice Capture & Entry Using AI
Author : CA. JAYPRAKASH M TIWARI
Author : CA. JAYPRAKASH M TIWARI
PURCHASE BILL ENTRY AUTOMATION is a desktop-based workflow that automates the movement of purchase invoices from Gmail to accounting software. It downloads PDF invoices from selected senders, extracts invoice fields into an Excel register, prepares Tally-compatible XML masters/vouchers and Zoho Books-ready import output, and imports or prepares posting with user confirmation.
The use case is designed for small and medium CA offices and business accounting teams where repetitive purchase bill entry consumes staff time, creates avoidable errors, and delays ledger posting. The tool keeps documents on the user's system and does not require uploading invoices to a third-party AI platform.
NONE OF THE DOCUMENTS ARE UPLOADED ON ANY AI PLATFORM; THEREFORE CLIENT DATA REMAINS LOCAL AND THE DPDP ACT IS NOT BREACHED.
Purchase bills are commonly received by email as PDF attachments. Accounting staff must download each bill, read invoice details, classify the expense ledger, enter tax fields, create or verify supplier ledgers, and finally post entries in the accounting software.
| Component | Technology |
| GUI launcher | Python tkinter |
| Email access | Google Gmail API with OAuth credentials |
| PDF extraction | Python pdfplumber and extraction logic for multiple invoice formats |
| Excel output | Python openpyxl |
| Tally XML generation | Python-generated UTF-16 XML in Tally Prime format |
| Tally integration | Python requests on port 9000 where available, plus pyautogui and clipboard-assisted import |
| Zoho Books integration | Python-generated structured import file/API-ready data for purchase bill posting in Zoho Books |
| Trigger | Shortcut of JMTCO TOOL.vbs for one-click execution of the complete flow |
The proposed solution is an end-to-end Python automation pipeline triggered through the shortcut of JMTCO TOOL.vbs. A graphical launcher collects sender email, bill download location, Tally data path and accounting-system context. The system then downloads invoices, extracts fields, writes a date-wise Excel register, prepares Tally XML files and Zoho Books-ready import output, and guides posting/import into the selected accounting system.
| Capability | Description |
| Gmail invoice download | Connects through Gmail OAuth API, scans today’s emails from the selected sender, creates a date-stamped folder, and downloads PDF attachments. |
| PDF invoice extraction | Reads invoices from the date folder and extracts vendor, invoice number, date, taxable amount, GST split and total amount. |
| Excel register | Creates a detail sheet for line items and a summary sheet for invoice-level review with editable expense ledger classification. |
| Ledger/contact comparison | Reads existing Tally masters where available and supports supplier/contact checking before Tally or Zoho Books import. |
| Tally / Zoho Books import | Generates separate Tally XML files for missing supplier masters and purchase vouchers, and prepares Zoho Books-ready purchase bill import data with user confirmation. |
| Control Area | Implementation |
| Local processing | Invoices are processed on the user's computer. There is no requirement to upload invoices to an external AI service. |
| DPDP assurance | NONE OF THE DOCUMENTS ARE UPLOADED ON ANY AI PLATFORM; THEREFORE CLIENT DATA REMAINS LOCAL AND THE DPDP ACT IS NOT BREACHED. |
| Gmail access | OAuth is used through Google Cloud credentials. The first-run token is saved locally for subsequent authorized runs. |
| Human review | The Excel summary register allows review and correction of expense ledger classification before Tally XML import or Zoho Books posting. |
| Master/contact validation | Existing Tally ledger names and Zoho Books vendor/contact records can be compared before creating missing suppliers. |
| Traceability | PDFs, Excel register, Tally XML files and Zoho Books import data remain in date-stamped folders for future checking. |
| Requirement | Where Required | Remarks |
| Python and libraries | Each PC | Required for running the automation scripts and GUI. |
| credentials.json | Once per Google account/project | Created from Google Cloud Console after enabling Gmail API. |
| token.pickle | Created automatically on first run | Stores the user’s authorized Gmail session locally. |
| Tally Prime / Zoho Books access | Each accounting PC or Zoho Books organisation | Required for final import/posting and company/organisation selection. |
Google Cloud setup involves creating or selecting a project, enabling Gmail API, creating OAuth Desktop App credentials, downloading credentials.json, and adding the Gmail address as a test user where applicable.
| Area | Expected Improvement |
| Time saving | Significant reduction in manual downloading, reading, typing and posting of purchase bills. |
| Accuracy | Lower chance of mistakes in invoice number, dates, taxable values and GST components. |
| Compliance readiness | Better supporting records through preserved PDFs and structured Excel registers. |
| Scalability | Multiple invoices from a sender can be handled in one run and routed to Tally Prime or Zoho Books. |
| Office productivity | Staff can focus on exception review, ledger classification and client-facing work. |
PURCHASE BILL ENTRY AUTOMATION is a practical CA-office use case that applies automation to a daily accounting pain point. It reduces repetitive manual work, improves consistency, protects data by keeping processing local, and preserves accountant control through review checkpoints before Tally or Zoho Books import.
The use case is suitable for ICAI AI Hackathon submission because it demonstrates a working, affordable and practice-oriented application of AI-assisted automation for Chartered Accountants and small business accounting teams.