Forum Discussion

PMarriott's avatar
PMarriott
New Contributor
7 years ago

Changing Excel Data Source file name based on Environment change

I wish to use the same scripts but across a number of environments.  I would like each environment to use a different Excel data file to populate the data source.  However, I can not see how this can be achieved?  I have been able to change web service connection points and JDBC connections, but can not see how to change the file name for an Excel Data Source.

 

I would even be happy to change the tab name, rather than the file name, but this does not seem possible either.

  • Found my own answer.

     

    In case anyone else is wondering, what I did was create a Custom Property "sourceFile".

    Then in the Excel data source definition, I was able to reference that Custom Property by putting "${#Project#sourceFile}" in the file name property.  I also assume (although have not yet tested) that I would be able to change the Worksheet name in the same way.

     

    Hope others find this useful.

  • PMarriott's avatar
    PMarriott
    New Contributor

    Found my own answer.

     

    In case anyone else is wondering, what I did was create a Custom Property "sourceFile".

    Then in the Excel data source definition, I was able to reference that Custom Property by putting "${#Project#sourceFile}" in the file name property.  I also assume (although have not yet tested) that I would be able to change the Worksheet name in the same way.

     

    Hope others find this useful.

    • Olga_T's avatar
      Olga_T
      SmartBear Alumni (Retired)

      Hi PMarriott,

       

      Well done! Thanks for sharing :smileyhappy:

       

    • nuv7's avatar
      nuv7
      Occasional Contributor

      Hi,

       

      Can you provide me with detail steps how I can make this work? Thank you so much for your help.