Import from Excel

Discussion in 'Tally Integration' started by Partha Mondal, Mar 29, 2021.

  1. Partha Mondal

    Partha Mondal Member


    Dear all,
    I am new in TDL. I create a TDL for Import Ledger master from Excel file.
    But here I get some error. When I run my TDL then get this error. But my Excel driver is ok.
    Can anyone help me. I also attached my TDL code.

    ;;;; Shri Ganeshji

    [#Menu : GateWay of Tally]

    Key Item : Stock Item Import : K : Execute : PM Sales Import

    [Report : PM Sales Import] ;; Auto Report

    Form : PM Sales Import
    Title : $$LocaleString:"Stock Item Import"
    Auto : Yes

    [Form: PM Sales Import]

    No Confirm : Yes
    Space Top : 1
    Space Left : 1
    Space Right : 1
    Space Bottom : 1
    Option : Small Size Form
    Full Width : No
    Full Height : No
    Vertical Align : Centre
    Parts : PM Sales Import Title, PM Sales Import Details
    On : Form Accept : Yes : CALL : ImportSalesFunction


    Local : Field : PM SalesImport FileName : Modifies : PM SVExcelPath : Yes
    Local : Field : PM SalesImport FileName : Variable : PM SVExcelPath

    [Part: PM Sales Import Title]

    Lines : PM SalesTrans Imports, PM SalesTrans Imports Info

    [Line: PM SalesTrans Imports]

    Fields : Form Sub Title
    Space Bottom : 0.25
    Local : Field : Form Sub Title : Info : $$LocaleString:"Sales Transaction Import"

    [Line: PM SalesTrans Imports Info]

    Field : Simple Field
    Space Bottom : 0.75
    Local : Field : Simple Field : Info : $$LocaleString:"(Only Tally (XLS) Format is Supported)"
    Local : Field : Simple Field : Full Width : Yes
    Local : Field : Simple Field : Align : Centre

    [Part: PM Sales Import Details]

    Lines : PM SaleImport FileName

    [Line: PM SaleImport FileName]

    Field : Medium Prompt, PM SaleImport FileName
    Local : Field : Medium Prompt : Info : $$LocaleString:"Import File Name (XLS) :"

    [Field: PM SaleImport FileName]

    Use : Name Field
    Width : @@NarrWidth
    Set as : "F:\Ledmaster.xls"
    Full Width : Yes


    [Variable: PM SVExcelPath]

    Type : String
    Default : ""
    Persist : Yes

    [System: Variable]

    PMSVExcelPath : ""

    [System: Formula]

    PMExcelFilePath : ##PMSVExcelPath

    [Collection : PMExcelFileColl]

    ODBC : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + @@PMExcelFilePath
    SQL : "Select * from [Sheet1$]"

    SQLObject : PM SalesTran Object
    Client Only : Yes

    [Object : PM SalesTran Object]

    PmLedName : $_1
    PmLedParent : $_2
    PmLedOpBal : $_3
    PmLedAdd1 : $_4
    PmLedAdd2 : $_5
    PmState : $_6
    PmPincode : $_7


    [Collection : PMSalesMasterColl]

    Source Collection : PMExcelFileColl
    Fetch : *.*

    compute : PmLedName : $_1
    compute : PmLedParent : $_2
    compute : PmLedOpBal : $_3
    compute : PmLedAdd1 : $_4
    compute : PmLedAdd2 : $_5
    compute : PmState : $_6
    compute : PmPincode : $_7


    [Function: ImportSalesFunction]
    ;; Procedural Block
    Variable : Counter : Number

    ;; Definition Block
    01 : SET FILE LOG ON
    02 : SET : Counter : 0
    03 : START PROGRESS : ($$NumItems:pMSalesMasterColl) : "Sales Trans Import" : @@CmpMailName : "Importing SalesBill..."

    05 : WALK COLLECTION : PMSalesMasterColl

    20 : NEW OBJECT : Ledger

    30 : SET VALUE : Name : $PmLedName
    40 : SET VALUE : Parent : $PmLedParent

    41 : Insert Collection Object : Address
    42 : If:NOT $$isempty:$PmLedAdd1
    43 : SET VALUE : Address : $PmLedAdd1
    44 : END IF
    45 : Set Target:..

    46 : If:NOT $$isempty:$PmLedAdd2
    47 : SET VALUE : Address : $PmLedAdd2
    48 : END IF
    49 : Set Target:..

    80 : Create Target
    90 : Increment : Counter
    100 : Show Progress : ##Counter
    110 : End Walk
    120 : End Progress
    130 : MSGBOX: "Status" :"Sales Transaction Imported \n successfully!!! "
    140 : SET FILE LOG OFF
    150 : RETURN




    Thanks.


    ERROR-1.jpg
     


  2. Himanshu-2002

    Himanshu-2002 Active Member


    Try to hardcode the excel path and check
     


  3. Neeru

    Neeru Member


    Hi..

    I Think Driver and Excel bit not match..check Excel (Office ) and Drive are the same bit. (32bit or 64Bit)


     


Share This Page