Wednesday 18 September 2019

Import vouchers from Excel to Tally - New method


The benefits of preparing vouchers in Excel and importing into Tally are many. This saves a lot of time and can be convenient as you can copy-paste, fill down, use formulas and do lot more in Excel. This can be immensely helpful while :
  • Preparing year-end entries like depreciation
  • Huge volume of entries in sales, purchases, etc.
  • Entries repeating in a particular frequency
  • Import bank statements
  • And most important, import transactions from another software.

See Video Tutorial :

There are many software and add-ons available for this purpose, but the method explained here does not use any third-party software or tools. The user must be familiar with MS Excel and Tally to do this. The old method used mail-merge feature of MS Word. This new method uses only MS Excel and is more simple. Please refer to the old method here. Tested on Tally.ERP 9. Though this seems a bit complex, you can be sure - it works, and it's free.

● Create necessary ledgers

Create all the necessary masters (ledgers) in Tally first. Here I've created two ledgers - "ABC Wholesalers" and "XYZ Distributors" under the group "Sundry Creditors". Also, I've created a "Medicine Purchase" ledger under the group "Purchase Accounts".  Note that while creating masters by copy-pasting the names from excel, invisible characters can join to the end of the text, which can create errors while importing. In such cases, save the excel as text/csv and open in Notepad++ and copy-paste from there. You can also copy-paste from excel to Notepadd++ first and then from there to Tally.

● Make a sample entry in Tally

Create a sample voucher exactly of the nature of the vouchers to be imported. Here I've created a Journal Voucher with Medicine Purchase Dr. Rs.2000 and ABC Wholesalers Cr. Rs.2000. In case of vouchers involving multiple ledgers, create similar one as sample.


Export the sample voucher from Tally

Open day book (Display > Day Book) and press Alt+E to export the day book to XML format. Note that there shall be only a single voucher that we created above on this day. This step is to create a template for import. The exported file will be saved to Tally folder as "DayBook.xml"


● Open the XML file exported from Tally

You can use any advanced editors like Notepad++ with syntax highlighting or simply use notepad. Take note of the data fields.


Prepare data to import in Excel file

  • Please note that the columns shall be in the exact order as the data fields appear in the xml file above. 
  • The date field shall be in YYYYMMDD text format. This shall be either entered into a text formatted column or use formulas like =CONCATENATE (TEXT (YEAR (A1),"0000"), TEXT(MONTH(A1),"00"), TEXT(DAY(A1),"00")) where A1 contains the date. 
  • Decimals must be limited to two. Use =ROUND(Number, 2) function to achieve this. The decimals may appear in the display to be two due to the formatting of the cells and be different internally. In such case, it may lead to an error while importing. 
  • Numbers shall not be comma separated or currency formatted, but formatted as numbers.
  • The debit value shall be negative. Both debit and credit should tally. Use some function to check this. Else, it may cause error while importing.
  • Since tally uses the ledger name to match while importing, it is very important that the ledger names used in excel is exactly the same as that in Tally. To avoid typos you may export the ledger masters from tally (Gateway > Display > List of Accounts > Alt+E) as a text file and use Copy+Paste.
  • Special characters in the data including those in ledger master names and narrations can cause errors while importing to tally.  To find this or replace, open the data as text/csv in Notepadd++ and use the regular expression [^a-zA-Z0-9\,\.\-\r\n\s]+ which matches all characters other than alphabets, digits, comma, dot, hyphen, linefeed, carriagereturn, and space. This can be removed or replaced with some acceptable character. This step can be done in the generated final xml also.
    • Special characters in ledger master names will have to be corrected manually in Tally, and if there are a large number of masters, it can be exported as xml, corrected, and imported back.


● Copy XML portion to edit

Copy the portion of the XML from  <TALLYMESSAGE xmlns:UDF="TallyUDF">  to </TALLYMESSAGE> to a new file. This is the portion we need to replace. Note this position in the original xml file, since we have to paste the final output here. The header and footer XML codes shall remain unchanged.



Remove identifiers

  • In the copied XML, remove the values (highlighted in yellow) from the tags <VOUCHER> and <GUID> which are unique identifiers inserted by Tally. Remove the values only, and not the tags. 
  • Also remove the entire tag <EFFECTIVEDATE>xxxx</EFFECTIVEDATE>, (highlighted in yellow).
  • Optionally you may remove everything inside the <VOUCHER> tag (underlined in red). This is optional.



Format the XML to single lines

Separate the static data (the XML tags) and the variable data (the values) into separate lines. Remove the linefeeds and ensure that all the XML tags before and after the data are on a single line. This can be done easily in Notepad++ by selecting the required text and pressing Ctrl+J.



Insert columns in Excel

Insert one column each between the columns of data in Excel.



Copy-paste the XML static data lines

Copy each static data line of the XML (highlighted in yellow) and paste it into the first row in the respective columns in the Excel sheet.



Drag the cells to auto-fill into all rows

Use fill-handle and drag to auto-fill the data to all rows in the column.


Concatenate / Copy data

  • Use concatenate function  =CONCATENATE(A2,B2,C2,...,N2,O2) to combine data of all the columns in a row. Use CTRL+Click inside the function to select cells one by one. Drag using fill-handle to apply the formula to all rows. In case of very lengthy xml tags, concatenate function can trigger errors.
  • You can also simply select and copy the entire cells directly and paste in Notepadd++. The concatenate step can be avoided altogether. 
    • But in such case, remove tab characters after pasting. Use regex \t in Notepad++ to find and replace tab characters.


Paste the XML data to original file

Copy the concatenated data or from the cells directly and paste it into the original XML file in the same position to replace the text. Do not modify the xml tags in the beginning and at the end. Save the XML file.





● Import into Tally

Before doing import, ensure to configure the following: Load the company > Press F12 (configure) > General > Ignore errors & continue during data import - set this to YES

In Tally, go to Import of Data > Vouchers. Enter the xml filename with path and press enter to import. In case of any error, see the import log file tally.imp in the Tally folder. Analyzing this file can identify why the error occurred.


● Complete

The vouchers would be available in the day book.


The same method can be used to import masters (ledgers) also. For this, go to Display > List of Accounts and export as XML for schema. Then use the same methods to generate an XML and go to Import of Data > Masters to import it to Tally.


58 comments:

  1. Thankx for your Great Effort sir. Can you please do the same for "sales with Inventory" it will be really Great for ppl like me. Please Sir thx

    ReplyDelete
    Replies
    1. This method can be used for any type of vouchers including sales with inventory. In that case create a sample voucher of your desired type and use that as the template.

      Delete
  2. The xml imports only 01.04.2019 and not subsequent date entries. The error log also not displaying description. it only states Number of errors.

    Any remedy to rectify this.

    Thanks.

    ReplyDelete
    Replies
    1. Please check the data for errors. Date & number formats shall lead to such errors.

      Delete
    2. In tally education mode , we can pass entries only on 1st,2nd and 30/31st of every month.
      we cannot pass entries on remaining dates

      Delete
  3. Parse error, possibly no single root or element has mixed content

    ReplyDelete
    Replies
    1. Please check your XML for syntax errors. Date & number formats shall lead to such errors.

      Delete
  4. THANK YOU SO MUCH SIR..
    IT HELPED A LOT


    I M SHORT OF WORDS TO THANK YOU

    ReplyDelete
  5. Not working for payment vouchers. For purchase it works fine. After purchase I tried payment vouchers but it does not work.
    I made a sample payment voucher and exported it. Then created the template as per your instructions. Imported back to Tally erp. Gives "Parse error, or not single root or element mixed up" error. WHat needs to be done.

    ReplyDelete
  6. Hi,

    Thanks for sharing the information, It really helped me for my task.

    Can you please assist on how to add BANKALLOCATIONS.LIST in tally XML.

    Thanks and regards

    ReplyDelete
  7. How do u follow below step ?
    Copy each static data line of the XML (highlighted in yellow) and paste it into the first row in the respective columns in the Excel sheet.

    u use replace function. please xplain what symbol is in the search option?
    in notepad ++

    ReplyDelete
    Replies
    1. Nothing is to be replaced in this step. Just copy each static line to respective columns in the excel sheet. Later it will be dragged to all rows in the sheet.

      Delete
  8. Eureka!!!! It Works...Thank you Manu...

    ReplyDelete
  9. Thank you very much for your new method so that i have learned about importing data to tally and it has saved my time.

    ReplyDelete
  10. Hello sir, your explanation is just aweosome and user friendly. i have one confusion that if a certain ledger is not available in tally then how can I order tally to open that ledger?

    ReplyDelete
    Replies
    1. That is not possible in this way. The ledger must be there in Tally and needs to be matched.

      Delete
  11. Hi,
    When creating Fixed Deposit where can we mention Date of Maturity and Interest Rate?

    ReplyDelete
  12. Hi,
    In Receipts and Payments of Tally is there a way we can find out total fixed deposits that we have? If yes, how to go about it.

    ReplyDelete
    Replies
    1. That depends on how you have structured the ledgers. If they are under a group called deposits, you can see it in the Balance Sheet.

      Delete
  13. Hi in Tally Receipts and Payments is there a facility to know the total value of FDs? If yes, how to go about it.

    ReplyDelete
  14. "Parse error, or not single root or element mixed up" while uploading payment vouchers, please suggest the way forward for troubleshooting

    ReplyDelete
    Replies
    1. The data you import may contain restricted characters, or the method you do might be incorrect. Please try the method with one single voucher and thereafter increase the volume if successful.

      Delete
    2. Remove the VCHKEY= "" from the tag after the TALLYMESSAGE TAG. It will work.

      Delete
  15. Thanks a lot for the awesome tutorial. I am trying to use the method for adding Salary vouchers. In my XML file I am having , and tags. Do i need to modify the values between these tags or should i remove these tags? Every time i download a sample Daybook xml, these values keep on changing. Please help how should i deal with these tags

    ReplyDelete
  16. hello sir,i have an issue with importing data using journal with stock item and vat ledger,how can i import them

    ReplyDelete
  17. Can we remove "2-Apr-2019 at 23:40 2-Apr-2019 at 23:40" completely or at least the value inside tags?

    ReplyDelete
  18. Sir I have more than 5000 entries, trying your method, Parse error, i really can't figure out, i followed the method to T. All the date formats are correct, decimal is restricted to 2. Syntax is correct! i checked all the tags, opened and closed. What could be the reason for parse now?

    ReplyDelete
    Replies
    1. Obviously, the issue can be only in the data. Try importing just 1 voucher, then 10, and thus try increasing the numbers, and find out where the problem is.

      Delete
    2. Not even 1 entry is getting accepted

      Delete
    3. Then there is something seriously wrong with the data. Please verify the data thoroughly. That is the only solution. Read all the above comments for possible errors and solutions.

      Delete
  19. I am using notepad++ but am unable to delete the line breaks with replace command. Also I am getting "22:51:59 : Line 52: Parse error, possibly no single root or element has mixed content"...Plz help.

    ReplyDelete
    Replies
    1. Please refer to that line number. There might be some error in the syntax or some characters might be triggering the error.

      Delete
    2. @Manmohan Sethumadhavan, Hi I am Sanjay from the Youtube, where I said that I could do the uploads in Tally with The word file, but I am geting these error"21:28:42 : Line 604: Semi-colon ; expected." and those data are not uploaded.Plz help to rectify the error.

      Delete
    3. The problem lies in your data. Some special characters might be the reason. Try to import 1 voucher first.

      Delete
    4. Special characters in the data including those in ledger master names and narrations can cause errors while importing to tally. To find this or replace, open the data as text/csv in Notepadd++ and use the regular expression [^a-zA-Z0-9\,\.\-\r\n\s]+ which matches all characters other than alphabets, digits, comma, dot, hyphen, linefeed, carriagereturn, and space. This can be removed or replaced with some acceptable character.

      Delete
  20. issue will happened while importing data with string content "&,"",'" in fields.. so it is very difficult and transaction with inventory details can not import ..

    ReplyDelete
    Replies
    1. That is a common issue with XML, Tally and other data handling. In that case, remove such characters from your data before processing.

      Delete
  21. My first entry is getting imported and all the remaining entries are showing error of Parse error, possibly no single root or element has mixed content. When I tried to break the line and do the same in batches, it again imported the first transaction and showed error for all the rest. What might be the error ?

    ReplyDelete
    Replies
    1. There might be some error in the structure or data. Some special characters might be the cause. Please see the tally error log. Also, enable the setting to continue even if there is an error. These are described in the post.

      Delete
    2. Special characters in the data including those in ledger master names and narrations can cause errors while importing to tally. To find this or replace, open the data as text/csv in Notepadd++ and use the regular expression [^a-zA-Z0-9\,\.\-\r\n\s]+ which matches all characters other than alphabets, digits, comma, dot, hyphen, linefeed, carriagereturn, and space. This can be removed or replaced with some acceptable character.

      Delete
  22. It was very useful and he is very much cooperative. I have contacted him personally and he provided so much help form me. Together we have closed certain issue i faced. I was totally unaware of XML language but still i can handle it. First 2-3 times it was totally failure and i seek help from him. But he encouraged me to check it again which provide me much confidence to make multiple types of entries in which i am successfully importing ledgers. Thanks bro. Regards-Arunkumar Trivandrum

    ReplyDelete
  23. i was importing ledger group with gst details but only 5 ledger got imported and remaining didn't the error shows that parse error , possibly no single root or element has mixed content

    ReplyDelete
    Replies
    1. Please go through the above comments. The data may contain some special characters, or the syntax might be wrong.

      Delete
  24. Sir, not able to import tally, it will exit when try to import. tally.imp file says as follows:
    Importing Data from 'C:\Users\Default\Documents\ImportApr.xml' on 4-Aug-2021 at 14:35:

    Importing Data to company: 'Previse Management Consultants Private Limited'
    Semi-colon ; expected.
    Semi-colon ; expected.
    Semi-colon ; expected.
    Semi-colon ; expected.
    Semi-colon ; expected.
    Semi-colon ; expected.
    Semi-colon ; expected.


    Total number of ERRORS : 36
    ----------------------------------
    What could be the issue?

    ReplyDelete
    Replies
    1. Please go through the above comments. The data may contain some special characters, or the syntax might be wrong.
      Delete

      Delete
    2. I also was encountering these problem, this is generally due to special characters in narration, specially "&" sign or "\"

      Delete
    3. I have used this method many time successfully, but today when i am trying this, after 10s of attempts i am not able to successfully able to import all of the records
      I have aprox 250 records and only 1-2 or max 10-12 records gets imported and thats all

      There is no error message or such and now i am totally clueless.
      I would highly appreciate if you could help me out

      What I have done so far:
      1. removed all special characters from narration
      2. copy pasted exact ledger names from tally
      3. remote id and guid id removed

      Now I really have no clue whats wrong. There is no specific error message

      Delete
  25. I have used this method many time successfully, but today when i am trying this, after 10s of attempts i am not able to successfully able to import all of the records
    I have aprox 250 records and only 1-2 or max 10-12 records gets imported and thats all

    There is no error message or such and now i am totally clueless.
    I would highly appreciate if you could help me out

    What I have done so far:
    1. removed all special characters from narration
    2. copy pasted exact ledger names from tally
    3. remote id and guid id removed

    Now I really have no clue whats wrong. There is no specific error message

    ReplyDelete
    Replies
    1. Please see the tally error file. Also, try with 1 record and if it gets imported, simply duplicate that to many and try. If it works, the issue is within the data only.

      Delete
    2. The Tally error file doesnt state any specific error

      Here is the error

      Importing Data from 'D:\Dropbox\One Drive\Tally 9\Jugad\NJ\20-21\rcptsnew.xml' on 26-Dec-2021 at 02:55:

      Importing Data to company: 'NJ'


      Number of Entries Created : 1
      Total number of ERRORS : 1


      Earlier I was getting semi colon error, but after removing special characters from narration that problem is solved, but still i am not able to get it through

      There 12 specific entries which are getting import everything time, and i done see any specific pattern in those 12 enteries which make it different from other enteries.

      It is highly frustrating , coz i have done this 100s of times, everytime there are teething issues which gets resolved, but this time, it has been 3 days, without any success.
      If we you wish and available lets do a quick anydesk or call.

      Appreciate your efforts
      TIA

      Delete
    3. I have an issue with excel data to Tally. Should the xml file be saved on desktop or in the Tally file? How will I get the Import File Name (XML) when importing to Tally?

      Delete
    4. You can learn how to import xml from this video : https://www.youtube.com/watch?v=_CFL6ueZuGE

      Delete

 
Back to top!