Exercise 22

Import Ledger Masters with Contact Details and Address

Published


This exercise teaches you how to import Ledger masters together with their contact details and address from Excel into Tally Prime. The exercise uses the LEDMAILINGDETAILS.LIST tag to fill the mailing details as required for TallyPrime 3.0 and higher versions.

Step 1 — Prepare the Excel sheet

Create an Excel sheet with one row per ledger. Column A (Sr No) is for reference only. Leave the contact and address cells blank for ledgers that do not need them, such as Cash or an expense ledger.

A B C D E F G H I J K L M N O P
1 srno Ledger Name Alias Under Group Contact Person Address Line 1 Address Line 2 Address Line 3 City Pincode State Country Phone Mobile Email Website
2 1 Udi Magic Solutions UDI001 Sundry Debtors Kuldeep Singh 12 Tech Park Sector 62 Noida 201301 Uttar Pradesh India 0120-4567890 9810000001 [email protected] www.udimagic.in
3 2 Sharma Traders SHA001 Sundry Debtors Rajesh Sharma 45 Gandhi Road iffco New Delhi 110005 Delhi India 011-25761234 9810000002 [email protected]
4 3 Mehta Enterprises MEH001 Sundry Debtors Amit Mehta 7 Ring Road Navrangpura Ahmedabad 380009 Gujarat India 079-26301234 9825000003 [email protected]
5 4 Patel Retail PAT001 Sundry Debtors Hiren Patel 22 MG Road Adajan Surat 395009 Gujarat India 0261-2781234 9898000004 [email protected]
6 5 Global Supplies Pvt Ltd GSP001 Sundry Creditors Neha Verma 101 Industrial Area Phase 2 Chandigarh 160002 Chandigarh India 0172-2651234 9815000005 [email protected] www.globalsupplies.in
7 6 Kumar Wholesale KUM001 Sundry Creditors Sunil Kumar 9 Market Yard Gultekdi Pune 411037 Maharashtra India 020-24261234 9822000006 [email protected]
8 7 Rao Electronics RAO001 Sundry Creditors Venkat Rao 5 Brigade Road Ashok Nagar Bengaluru 560025 Karnataka India 080-25591234 9845000007 [email protected]
9 8 HDFC Bank - Current A/c HDFC Bank Accounts Branch Manager Sector 18 Branch Noida 201301 Uttar Pradesh India 0120-4001234 [email protected] www.hdfcbank.com
10 9 Cash CASH Cash-in-Hand India
11 10 Office Rent RENT Indirect Expenses India

Step 2 — Write the XML tags in a separate file

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

<!--
  PURPOSE
  Create Ledger Masters with contact details and address in
  TallyPrime 3.0+ from ledger-master-with-contact-details-and-address.csv. Every value is read from
  the CSV through COLUMNREFERENCE / FORMULA; nothing is typed in this file except fixed Tally flags.

  CSV columns (first row is the header, CELLREFERENCE A1):
  A = srno (reference only)        B = Ledger Name                 C = Alias
  D = Under Group                  E = Contact Person              F = Address Line 1
  G = Address Line 2               H = Address Line 3              I = City
  J = Pincode                      K = State                       L = Country
  M = Phone                        N = Mobile                      O = Email
  P = Website
-->
<XMLTAGS CELLREFERENCE="A1" xmlns:UDF="TallyUDF">

  <MASTER TYPE="LEDGER">
    <!-- Ledger name (column B) and alias (column C). The alias is skipped when blank. -->
    <NAME.LIST>
      <NAME COLUMNREFERENCE="B"/>
      <NAME SKIP="=Len(Trim(C#))=0" COLUMNREFERENCE="C"/>
    </NAME.LIST>
    <PARENT COLUMNREFERENCE="D"/>

    <!-- REMARK: Bill-by-bill is switched on only for party ledgers. -->
    <ISBILLWISEON FORMULA="=If(Or(Trim(D#)=&quot;Sundry Debtors&quot;,Trim(D#)=&quot;Sundry Creditors&quot;),&quot;Yes&quot;,&quot;No&quot;)"/>
    <AFFECTSSTOCK>No</AFFECTSSTOCK>
    <ISCOSTCENTRESON>No</ISCOSTCENTRESON>

    <!-- Contact details; each tag is skipped when its column is blank. -->
    <LEDGERCONTACT SKIP="=Len(Trim(E#))=0" COLUMNREFERENCE="E"/>
    <LEDGERPHONE SKIP="=Len(Trim(M#))=0" COLUMNREFERENCE="M"/>
    <LEDGERMOBILE SKIP="=Len(Trim(N#))=0" COLUMNREFERENCE="N"/>
    <EMAIL SKIP="=Len(Trim(O#))=0" COLUMNREFERENCE="O"/>
    <WEBSITE SKIP="=Len(Trim(P#))=0" COLUMNREFERENCE="P"/>

    <!-- REMARK: Tally has no separate City field, so City (column I) is kept as the last address line. -->
    <ADDRESS.LIST>
      <ADDRESS SKIP="=Len(Trim(F#))=0" COLUMNREFERENCE="F"/>
      <ADDRESS SKIP="=Len(Trim(G#))=0" COLUMNREFERENCE="G"/>
      <ADDRESS SKIP="=Len(Trim(H#))=0" COLUMNREFERENCE="H"/>
      <ADDRESS SKIP="=Len(Trim(I#))=0" COLUMNREFERENCE="I"/>
    </ADDRESS.LIST>
    <PINCODE SKIP="=Len(Trim(J#))=0" COLUMNREFERENCE="J"/>
    <COUNTRYNAME FORMULA="=If(Len(Trim(L#))=0,&quot;India&quot;,Trim(L#))"/>
    <LEDSTATENAME SKIP="=Len(Trim(K#))=0" FORMULA="=Proper(Trim(K#))"/>

    <!-- Tally Prime 3.0: mailing details (printed name, address, state, country, pincode) -->
    <LEDMAILINGDETAILS.LIST SKIP="=Len(Trim(F#&amp;I#&amp;J#&amp;K#))=0">
      <APPLICABLEFROM>20260401</APPLICABLEFROM>
      <MAILINGNAME COLUMNREFERENCE="B"/>
      <ADDRESS.LIST>
        <ADDRESS SKIP="=Len(Trim(F#))=0" COLUMNREFERENCE="F"/>
        <ADDRESS SKIP="=Len(Trim(G#))=0" COLUMNREFERENCE="G"/>
        <ADDRESS SKIP="=Len(Trim(H#))=0" COLUMNREFERENCE="H"/>
        <ADDRESS SKIP="=Len(Trim(I#))=0" COLUMNREFERENCE="I"/>
      </ADDRESS.LIST>
      <PINCODE SKIP="=Len(Trim(J#))=0" COLUMNREFERENCE="J"/>
      <STATE SKIP="=Len(Trim(K#))=0" FORMULA="=Proper(Trim(K#))"/>
      <COUNTRY FORMULA="=If(Len(Trim(L#))=0,&quot;India&quot;,Trim(L#))"/>
    </LEDMAILINGDETAILS.LIST>
  </MASTER>
</XMLTAGS>

Step 3 — Save the file

Save it as ledger-master-with-contact-details-and-address-xml-tags.xml. In the Save as type box, choose All Files — otherwise Notepad appends .txt and you'll end up with ledger-master-with-contact-details-and-address-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.
Remarks:
  1. Every value is read from the sheet through COLUMNREFERENCE or FORMULA. Only fixed Tally flags are typed in the XML file.
  2. SKIP="=Len(Trim(X#))=0" leaves out a tag when its column is blank, so ledgers without an alias, contact or address import cleanly.
  3. Bill-by-bill (ISBILLWISEON) is switched on only when the Under Group (Column D) is Sundry Debtors or Sundry Creditors.
  4. Tally has no separate City field, so City (Column I) is added as the last address line.
  5. The country (Column L) defaults to India when blank, and Proper() tidies the State (Column K).
  6. LEDMAILINGDETAILS.LIST is a TallyPrime 3.0+ tag. It is skipped when the ledger has no address, pincode or state.
Sample files: Download the sample Excel sheet and matching XML tags file for this exercise. Download ledger-master-with-contact-details-and-address.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