Exercise 20

Update Ledger Name in Tally

Published


This exercise teaches you how to rename existing Ledgers in Tally Prime from Excel. Each row of the Excel sheet holds the ledger's new name, its old name and its group. You will use ACTION="Alter" to update existing masters instead of creating new ones, the OLDNAME tag to tell Tally which ledger to rename, and the SKIP attribute to ignore blank values.

Step 1 — Prepare the Excel sheet

Create an Excel sheet with one row per ledger. Put the new ledger name in Column B, the name the ledger has in Tally today in Column C, and its group in Column D. Column A (Sr No) is for your reference only and is not imported into Tally.

A B C D
1 sr.no name old name group name
2 1 Sharma Traders Pvt Ltd Sharma Traders Sundry Debtors
3 2 Gupta Electronics Gupta Electric Store Sundry Creditors
4 3 Verma & Sons Enterprises Verma Sons Sundry Debtors
5 4 Patel Industries Ltd Patel Industries Sundry Creditors
6 5 Singh Hardware Mart Singh Hardware Sundry Debtors
7 6 Agarwal Textiles LLP Agarwal Textile Sundry Creditors
8 7 Mehta Logistics Services Mehta Transport Sundry Debtors
9 8 Kumar Stationery House Kumar Stationers Sundry Creditors
10 9 Joshi Agro Products Joshi Agro Sundry Debtors
11 10 Reddy Construction Co Reddy Builders Sundry Creditors

Step 2 — Write the XML tags in a separate file

Open Notepad (or any plain-text editor) and write the following XML tags:

<!--
  Column A = Sr No (not imported)     Column B = New Ledger Name
  Column C = Old Ledger Name          Column D = Group Name
-->
<XMLTAGS CELLREFERENCE="A1" xmlns:UDF="TallyUDF">
    <!-- ACTION="Alter" updates existing LEDGER Masters -->
    <MASTER TYPE="LEDGER" ACTION="Alter">
        <!-- New ledger name; skipped when Column B is blank -->
        <NAME SKIP="=len(trim(B#))=0" COLUMNREFERENCE="B"/>
        <!-- Existing ledger name in Tally, which is replaced by the new name -->
        <OLDNAME COLUMNREFERENCE="C"/>
        <!-- Group of the ledger; skipped when Column D is blank -->
        <PARENT SKIP="=len(trim(D#))=0" COLUMNREFERENCE="D"/>
    </MASTER>
</XMLTAGS>
Note:
  1. ACTION="Alter" tells Tally to update an existing master. Without it, Tally would try to create a new ledger.
  2. Old Name is udiMagic supported tag. It is used to update existing masters, and is ignored when creating new ledgers. Tally looks up the ledger named in Column C and replaces its name with the value in Column B.
  3. SKIP="=len(trim(B#))=0" ignores the name when Column B is blank, so the ledger keeps its current name. The same applies to the group in Column D.
  4. No ledger names are typed in the XML file. Every value is read from the Excel sheet through COLUMNREFERENCE.
  5. See udiMagic XML tags for the full tag/attribute reference. Comments are written using the <!-- --> syntax.

Step 3 — Save the file

Save it as update-ledger-name-xml-tags.xml. In the Save as type box, choose All Files — otherwise Notepad appends .txt and you'll end up with update-ledger-name-xml-tags.xml.txt instead.

Step 4 — Import into Tally

  1. Start Tally Prime and open the company you want to import into.
  2. Minimize Tally (leave it running).
  3. Start udiMagic and select Excel to Tally.
  4. Select option Masters.
  5. Browse to select both the Excel sheet and the XML tags file — you're prompted for the XML file on the same screen as the Excel sheet.
  6. Follow the wizard to complete the import.
Sample files: Download the sample Excel sheet and matching XML tags file for this exercise. Download update-ledger-name.zip

Ready to import your Excel data into Tally?

Download udiMagic and start a 14-day free trial — no credit card required.

Download udiMagic View Pricing