Forum Discussion

okpo_ekpenyong's avatar
okpo_ekpenyong
New Contributor
12 years ago

Error While Retrieving Excel File

Hi,

I get a runtime error while trying to trace a path to an external excel file stored in this location: "C:\Users\Public\Documents\MyTestCompleteFiles\Data-Driven Testing\DD_Book.xlsx), using ExcelDriver.



I'm using Excel 2007 and the worksheet is named "DD_Sheet".



Please can somebody tell me how to deal with this?



Thanks'



Okpo.
  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    Nevermind, didn't read the code properly....



    You need to escape the backslashes in the path. Instead of C:\TestPath\TestFile.xlsx, write C:\\TestPath\\TestFile.xlsx.
  • karkadil's avatar
    karkadil
    Valued Contributor
    Without code example and error message it is impossible to guess
  • Hello Gena,

    Thanks for your interest in helping. Here is the full code snippet:

    function Main()

    {

      var orders, mainForm, orderForm, groupBox, dataDriver;



      dataDriver = DDT.ExcelDriver("C:\Users\Public\Documents\MyTestCompleteFiles

      \Data-Driven Testing\DD_Book.xlsx", "DD_Sheet", true);

      TestedApps.RunAll();

      orders = Aliases.Orders;

      mainForm = orders.MainForm;



    Please find attached also, the error message. Just in case you can't view the error log, here it is:



    JScript runtime error.



    The Excel worksheet "C:UsersPublicDocumentsMyTestCompleteFilesData-Driven TestingDD_Book.xlsx" does not exist.

    Error location:

    Unit: "DDTSuite\DDT_JScript\Script\JScript"

    Line: 73 Column: 3.

     

    Best regards,



    Okpo.