0
[Collection:ExcelLedgersCollection]
    ODBC: "Driver={Microsoft Excel Driver (*.xls,*.xlsx,*.xlsm,*.xlsb)};DBQ=C:\Desktop\List.xls"
    SQL: "Select * from [Items$]"

[Function: ImportFromExcel]
    Variable    :TotalEntries   :Number
    Variable    :Count          :Number
    00: Set     :TotalEntries   :$$NumItems:ExcelLedgersCollection
    10: Start Progress: ##TotalEntries :"Items Creation" : "Importing Items in" : ##SVCurrentCompany
    20:     Walk Collection: ExcelLedgersCollection
    30:         New Object      :Ledger
    40:             Set Value   :Barcode    :$_1
    50:             Set Value   :Name       :$_2
    60:             Set Value   :Quantity   :$_3
    70:         Create Target
    80:         Show Progres    : ##Count 
    90:         Increment       :  Count 
    100:    End Walk
    110: End Progress
    120: Msg Box    : "Status" : "Ledgers from Excel Imported Successfully"


[#Menu: Gateway of Tally]
    Add: Item: Before:@@locQuit: "Import From Excel" :Call :ImportFromExcel

I ran the above code and I am getting the following two errors:

1 FUNCTION 'ImportFromExcel' LABEL:10 Invalid number of steps 2 FUNCTION 'ImportFromExcel' LABEL:10 Action execution failed!

The function basically tries to read the data from the excel file called List.xls. I have googled these two errors and I found some suggestions:

  1. The OS + Tally + Microsoft Office should all be either 32 bit or 64 bit.
  2. The excel file name extension should be xls instead of xlsx.

I have a 64 bit system and I have checked to make sure that both Office and Tally are 64 bit. Also, my file extension is .xls. Any other ideas as to why this might not be working?

mcfred
  • 1,183
  • 2
  • 29
  • 68

2 Answers2

0

After setting Totalentries on line 00 (it may be safer to modify the line number to 001), try printing Totalentries by giving the command 002: log: ##Totalentries. It seems to me there are no values in your ExcelLedgersCollection collection.

Mitalee Rao
  • 191
  • 6
0

1st we tried with Ms Office 2007 it never worked. But when we used Ms Office 2019 it worked properly.

Following code works fine under MS Office 2019

[#Menu:Gateway Of TAlly]

Add:Item:Ledgerimport:Call: Ledgerimport

[Collection : Ledgerimport] ODBC : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=D:\Baby\Tally\TDL\Source1.xlsx" SQL : "Select * From [Sheet1$]"

[Collection: ledsum] Source Collection:Ledgerimport Compute: lednm : $_1 ;Compute: op:$$Number:$_3 Compute: pr:$_2

[Function:Ledgerimport]

Variable:var1:String

Variable:var2:String

;Variable:var3:String

00: Walk Collection: ledsum

01: Set: var1:$lednm

02: log:##var1

03: Set: var2:$op

04: log:##var2

07: New Object:Ledger

08: Set Value:Name:$$String:##var1

09: Set Value:Parent:"Sundry Debtors"

10: Set Value:Mailing name:"tst"

;11: Set Value: openingbalance:##var2

;

;12: Insert Collection Object:Address

;13: set Target:Address

;14: Set Value:Address:$$String:##var3;"Street1"

15: set Target:..

16: Create Target

17: End Walk

18: Msg Box: "warning" : "Ledger master created"

S.N.Ramkumar. 94444 52115