Forum Discussion

cjfoeller0404's avatar
cjfoeller0404
Occasional Contributor
16 hours ago

How to Configure Relative Filepath for Stores|Tables Excel Sheet Import?

What is the process in which to use a relative file path to be able to import an Excel Sheet into a Stores|Tables object so that the table can be updated regardless of where in the file directory the TestComplete Project actually lives?

For example, if my file structure is something of the nature below, how would I access the Excelsheet.xlsx to import as a Stores|Tables New Excel Sheet?

  • Project Folder
    • Project Suite [.pjs file]
    • Project Folder
      • Project File [.mds file]
    • Data [Folder]
      • Excelsheet.xlsx

I have attempted "Data\Excelsheet.xlsx", ".\Data\Excelsheet.xlsx", "..\Data\Excelsheet.xlsx", and "..\..\Data\Excelsheet.xlsx" getting the same file not found error each time.

Is there a way to perform this action with a relative file path?
Selecting the file via the UI seems to only ever add the absolute path.

2 Replies

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Assuming your .xlsx file is in Project\Stores\Files

    Then you can use Project.Path together with the remaining path

    // Using the standard open file dialog, to select a file
    Sys.Browser(settings.GetBrowser()).WaitWindow("#32770", "Open", 1, 5000);
    Sys.Browser(settings.GetBrowser()).Window("#32770", "Open", 1).OpenFile(Project.Path + "Stores\\Files\\WebcoverAddNewFile.xlsx");
    

     

    • cjfoeller0404's avatar
      cjfoeller0404
      Occasional Contributor

      Alright, I have made a copy of my file and put it in a Files Folder in the Stores directory.

      Is there a way to do that through this UI Interface?: