Forum Discussion

srinivas_yadati's avatar
srinivas_yadati
Occasional Contributor
11 years ago
Solved

Is There Is any way to Acess the Excel Sheet when Data dynamically changes Every Day

Hi 



I want help for accessing the data from external sources when data of the excel sheet chages everyday.

for ex: i am using Today() function in excel sheet

the cvariable i created through DDT and Normal project variables are static and temporary.



please show me the solution for accesssing excel data through dynamic variables



  • If you're using Excel as a COM object you can disable the notifications popups ....



    app.DisplayAlerts = False



    Should do it in your case.

9 Replies

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3
    I wouldn't put Today() on a data sheet.  Just use it directly in the test.  It will always be current that way and you won't have to update it.  
  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3
    Do you read the Excel sheet every time you run the test?  It's not clear to me why a regular project or test variable would not work for you.
  • srinivas_yadati's avatar
    srinivas_yadati
    Occasional Contributor
    Hi

    Thanks for the Reply!!!!

    actually i am using some functions in the excel sheet like Today().

    So it is not updating the values of that cells , another day when i run the test ,It is only taking the old values which is assigned earlier or first run the test.

    I tried all the methods like ALE Driver and COM objects ,but  there is no effect on the excell cells updation.

    Only thing i found is we have to open the sheet every time before run the test(manually or Through script) ,it is working some way..





  • srinivas_yadati's avatar
    srinivas_yadati
    Occasional Contributor
    Hi,

    Thanks Again Marsha Robertson

    Eeven i tried in that way also but the fuctions i want  with date ,time and week number are complex in the smart bear they are not fecthing in the way(format) i want to validate through the check points .So its made or make simple for me if they fectches from sheet

    thats way presently i am opening the sheet before  running Test Case(through script only)

    like

    function test()

    {

    //code



         var fileName = "..//path.xlsx";

         var sheetName = "Sheet1";

         var app = Sys.OleObject("Excel.Application")

         Options.Run.Timeout = 30000;

         var book = app.Workbooks.Open(fileName);

         var sheet = book.Sheets(sheetName);

         book.Save();



    //code

        app.Quit();

    }



    some times this raising popup like do u want save the changes in the excel

    in that case my test case in failing/reporting an error

    if we have any solution its better



    for thar i am going use event handler..(learing)



    Thanks in advance..

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3
    Okay, a couple more questions.



    Are your tests in keyword format or in script format?



    Can you give me an example of the date/time you want to validate?







  • srinivas_yadati's avatar
    srinivas_yadati
    Occasional Contributor
    hi

    My tests are in Script format

    ex for validation date is "Monday mm/dd/yyyy"

    Every day date and day need to be changed (today)
  • If you're using Excel as a COM object you can disable the notifications popups ....



    app.DisplayAlerts = False



    Should do it in your case.
  • srinivas_yadati's avatar
    srinivas_yadati
    Occasional Contributor
    Thanks Marsha Robertson

    I Verified this solution earlier its meeting code metric standards and not effective i feel 

    but



    I agreed with the solution provided by the Colin McCrae ,its working fine 



    Once again Thanks for the Support Marsha Robertson Colin McCrae