How to Import a Tally Trial Balance into Excel using VBA
Question details
The user is looking for an Excel VBA code solution to automate the importation of a trial balance directly from Tally accounting software.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Automating the extraction and formatting of financial data from Tally to a spreadsheet for easier analysis and reporting.
- Observed behavior
- The user needs a specific VBA script or guidance on establishing a data connection between Excel and Tally to pull trial balance records.
Ensure that your Tally software is open and configured to allow ODBC connections, and that the Developer tab is enabled in your spreadsheet software so you can access the VBA editor.
Use ODBC Connection via VBA to Query Tally Data
The standard programmatic way to extract Tally data into Excel is by establishing an ADODB connection via Tally's built-in ODBC server.
Tally acts as a database server when its ODBC feature is enabled. You can use standard ADODB connection strings in VBA to query Tally Definition Language (TDL) tables, such as the Trial Balance, directly into your worksheet.
Open Tally, go to the Configuration or Settings menu, and ensure the ODBC server is enabled. Take note of the port number (default is usually 9000).
In Excel, press Alt + F11 to open the Visual Basic for Applications (VBA) editor. Click 'Insert' and select 'Module' to create a new blank script.
Write a VBA sub-routine using 'CreateObject("ADODB.Connection")'. Set the connection string to point to the Tally ODBC driver, formatted as 'Driver={Tally ODBC Driver}; DB=TallyData; Port=9000;'.
Use a Recordset object to pass an SQL query (e.g., 'SELECT * FROM TrialBalance') through the connection, and then use 'CopyFromRecordset' to output the fetched financial data into your desired worksheet cells.

Seek Custom VBA Assistance on Developer Communities
If you are unfamiliar with writing ADODB connection strings or parsing Tally data schemas, seeking customized code from expert developers is the most effective approach.
Analyze Tally Trial Balances with WPS Office
Need a fast, reliable, and lightweight spreadsheet tool for your accounting needs? WPS Office provides excellent compatibility with Microsoft Excel formats, allowing you to easily view, edit, and analyze exported Tally financial reports without expensive subscriptions.
- 1. Export Data from Tally: In Tally, navigate to your Trial Balance, press Alt+E to open the Export menu, and choose 'Excel (Spreadsheet)' as your output format.
- 2. Download WPS Office: Install WPS Office Free from the official website to get access to WPS Spreadsheet.
- 3. Open and Analyze: Launch WPS Spreadsheet and open the exported Trial Balance file to start filtering, formatting, and analyzing your financial data.

Frequently Asked Questions
Can I export a Trial Balance from Tally to Excel without using VBA?
Yes, Tally provides a native export feature. Simply open the Trial Balance report in Tally, press Alt+E (Export), select 'Excel' as the destination format, and Tally will automatically generate and open the spreadsheet.
Why is my VBA ODBC connection to Tally failing?
Connection failures usually occur if Tally is closed, if the ODBC server setting is disabled in Tally's configuration, or if the port number in your VBA connection string does not match the port Tally is broadcasting on (default is 9000).
Is it possible to schedule automatic Tally to Excel imports?
Yes, by combining an automated VBA macro (using the Workbook_Open event) with Windows Task Scheduler, you can automate the extraction process. However, Tally must remain open and running on the host machine for the ODBC connection to succeed.
Where can I find pre-written VBA templates for Tally integration?
You can often find open-source VBA modules and connection examples for Tally on developer forums like Stack Overflow, GitHub repositories, and specialized accounting software communities.




