Forum Discussion

DarkShadows's avatar
DarkShadows
Contributor
8 years ago

Stores_ How to store excel spreadsheet and provide its path in scripts

Hello All,

I'm trying DDT testing as Keyword tests in test complete, For this I'm able to  move all needed files into inbuilt store folder location of test complete however at one instance I need to pass entire excel file for one of the field i.e. upload data file (.xlsx) where I need to click on browse and select the spreadsheet , however its working by providing local desktop path but I want to make it generic and want to access it within test complete only so it will easy to run from any indivisual's machine.

 

Really appreciate if I will get some guideline on this thread regarding what specific syntax or command need to perform here?

 

is it something we need to handle this by passing as Variable ? or any other option.

 

Thanks in advance , I have added snapshot just for reference purpose . cheers !

 

  • So long as the location of your excel sheet is within the path of the project, you should be fine.  The script solution I posted before does not apply.  

     

    As an example, I created a folder in a test project of my called "ExcelFiles".  The MDS file is in C:\Source\MyProject\ and the ExcelFiles folder is a subfolder of that.  When I create a data driven loop using that spreadsheet, I get something like this:

     

    This way, no matter where I copy my project to, as long as I preserve the folder structure, it will always be able to find the excel sheet I want to use.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Best bet is to place your spreadsheet somewhere within the project path of your MDS file.

     

    So, for example, if your MDS file is stored in C:\MySource\MyProject\Project.MDS, then  put your spreadsheet someplace like

     

    C:\MySource\MyProject\ExcelSheets\

     

    Then you can use Project.Path or Project.ConfigPath in your string like Project.Path + '\\ExcelSheets\\' to get the path of your excel file.  

    • DarkShadows's avatar
      DarkShadows
      Contributor

      Thanks for script solution Robert,

      just a couple of questions :
      1)Does this script will run on any hosts machine or shall I need to update file path each time?

      2)Can you suggest some solution on keyword recording scripts please (please find attached snapshot the current solution I'm using it but again this is by using my local desktop path.)

      3) I'm looking for something that will help me to run this scripts on any machine without changing any filepath.

       

       

      Thanks

      Amit

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        So long as the location of your excel sheet is within the path of the project, you should be fine.  The script solution I posted before does not apply.  

         

        As an example, I created a folder in a test project of my called "ExcelFiles".  The MDS file is in C:\Source\MyProject\ and the ExcelFiles folder is a subfolder of that.  When I create a data driven loop using that spreadsheet, I get something like this:

         

        This way, no matter where I copy my project to, as long as I preserve the folder structure, it will always be able to find the excel sheet I want to use.