Python Automation
Automatic Tally Data Backup Script
Backs up your Tally data folder every day, keeps dated copies and alerts you if a backup fails.
₹999
₹1,499
Python Automation
Prepare hassle free primary Group Financials
One-time payment · Instant download after verification
# Group Financials from Tally (Python)
group_financials.py reads every member company of the group company ** Your Group Company** from Tally (port xxxxx). It writes **Group Financials.xlsx** with the statements for the whole group and for each branch.
## Use
1. Open Tally, load the group company, and log in as **Admin**.
2. Set the period in settings.ini (from_date, to_date; an empty to_date means today).
3. Double-click **Refresh Group Financials.bat**. It reads Tally and then opens the workbook.
Close Group Financials.xlsx before running the script again.
### Trial balance for any period
Double-click **Trial Balance (custom period).bat** and type the From and To dates (1-Jul-2026 or 01/07/2026; leave To empty for today). It writes **Trial Balance <from> to <to>.xlsx** and opens it. The workbook has:
- **Trial Balance**: all branches together, by Tally group (click + / - on the left to open a group), with Opening Dr/Cr, Debit, Credit and Closing Dr/Cr. The check row must show 0.
- **TB Detail**: one row per company and ledger. Filter the Branch column to get one branch's trial balance; row 4 totals the visible rows.
- **Stock Values**: the opening stock used.
The trial balance is laid out the way Tally shows it. Opening Stock (stock at From Date) stays under Stock-in-Hand for the whole period, and Difference in opening balances is its own line. Opening stock is known only when stock_input.csv (for the settings.ini From Date) or the saved Location Stock workbook is for the same From Date. Otherwise it is 0 and the stock appears in the Profit & Loss A/c line instead; Dr = Cr either way.
A From Date later than the stored history is fast, because only the vouchers in between are read. An earlier From Date re-reads the history, which takes about 13 minutes.
From the command line: python group_financials.py --tb-only --from 1-Jul-2026 --to 30-Sep-2026. --from and --to also work without --tb-only and override settings.ini for the full statements.
| File | Purpose |
|---|---|
| settings.ini | Tally URL, period, file names |
| companies.txt | Member companies, one per line (# leaves a company out) |
| fs_mapping.csv | Which Tally group goes to which statement line, and its cash-flow class |
| stock_input.csv | Typed stock values per company (optional) |
| history_cache.json | Ledger movements from Books From to the day before From Date (created by the script) |
## Speed
The first run, and the first run after from_date changes, reads every voucher since the books began. That takes about 20 seconds per company, roughly 13 minutes for all of them. The result is stored in history_cache.json. Later runs read only the period and the same period last year, which takes about a minute in total. If vouchers dated **before** From Date are changed in Tally, run Refresh Group Financials.bat --refresh-history.
Test on a single company with python group_financials.py --only DSM-2.
## Sheets
**Summary** (key figures and checks) · **Trial Balance** and **TB Detail** (as above) · **Profit & Loss** (period vs same period last year) · **Balance Sheet** (To Date vs day before From Date) · **Cash Flow** (indirect) · **Changes in Equity** · **P&L / BS / Cash Flow by Branch** · **Analysis** (GP %, NP %, ratios, debtor/creditor/inventory days, share of group, rank) · **Monthly Trend** · **Notes** (each line by group and ledger) · **Stock Values** · **Branch Summary** (check columns per branch, all must be 0) · **FS Mapping**.
## How the figures are worked out
The calculations are the same as in the Excel workbook in Tally Financials Excel/; its README has the details.
- Ledger opening = opening stored in the master + vouchers from Books From to the day before From Date. Cancelled and optional vouchers are left out.
- Income and expense ledgers start each period at 0. Earlier amounts are part of retained earnings.
- **Stock** is in no ledger. Opening and closing stock come from stock_input.csv if typed there. Otherwise they come from the saved Location Stock.xlsx: its closing value, and opening qty × rate as an estimate. Refresh and save that workbook for the same period first; the Stock Values sheet says whether the periods match. Last year's stock is used only if typed.
- **Difference in opening balances** = opening stock in the item masters + the Dr/Cr gap in the ledger openings, as Tally shows it.
- **Group = sum of the branches.** Head office / branch accounts and branch transfers are **not eliminated**.
## Formulas in the workbook
Ledger balances from Tally are written to **TB Detail** as values. Stock values go to **Stock Values**, also as values. The statements are Excel formulas that read those two sheets:
- Each line of the **Profit & Loss**, **Balance Sheet**, **Cash Flow** and the three **by Branch** sheets is a SUMIFS over TB Detail. For example, =-SUMIFS(TB_Period,TB_Line,"Revenue from sales"). A branch column adds TB_Company,"<company>".
- Every total, subtotal, gross profit, net profit and check is a SUM or a reference to the rows above. Summary, Changes in Equity and Branch Summary point to cells on the statements.
- Named ranges: TB_Company, TB_Top, TB_Ledger, TB_Line, TB_Open, TB_Period, TB_Close, TB_LastYear, TB_Statement, TB_Dep (columns of TB Detail), and Stock_Company, Stock_Open, Stock_Close, Stock_PYOpen, Stock_PYClose (columns of Stock Values).
- Inventories = the closing stock on Stock Values plus any ledger under Stock-in-Hand. The Opening Stock row of TB Detail is not counted. Retained earnings at To Date = its TB balance + net profit for the period.
- If you correct a balance or a stock value by hand, the statements recalculate. Check cells turn red when they are not 0.
- **Analysis**, **Notes** and the monthly amounts are still written as values.
## Safety on this Tally
The script sends only requests that have been tested as safe with the group company loaded (see the Excel README). It sends them **one at a time**, and every request defines its own TDL inline. Nothing needs to be loaded in Tally, and nothing in Tally changes. Don't run it while an Excel Tally workbook is refreshing.
**Access:** the script works only when **Admin** is logged in to Tally. For any other login the workbook is written empty, with no message. Every collection also carries the filter $$CmpUserName = "Admin".
No reviews yet. Customers who buy this product can leave a review from their account.
Python Automation
Backs up your Tally data folder every day, keeps dated copies and alerts you if a backup fails.
₹999
₹1,499