18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Writing into excel

lawrencelawrence Members
edited November -1 in Sahi - Open Source
I need to write the below content in excel:

S.No Steps Result (Pass/Fail)
1 xyz Pass
2 zyx Fail

I searched here and found a similar post where the user used "dba.update("update [Sheet1$] set date=$date where Sc_Name='Login'");"

I do not want to write the file by keeping a reference value. I want to write the file like:

<first step>
S.No Steps Result (Pass/Fail)

<second step>
S.No Steps Result (Pass/Fail)
1 xyz Pass

<third step>
S.No Steps Result (Pass/Fail)
1 xyz Pass
2 zyx Fail

Is it possible? Please advice.

Comments

  • Hi lawrence,

    You can write these contents into a csv file.

    Try the following code:
    var $ar = new Array();
    $ar[0] = ["Slno", "Steps", "Result(Pass/Fail)"];
    $ar[1] = ["1", "xyz" , "pass"];
    $ar[2] = ["2", "abc", "Fail"];
    _writeCSVFile($ar, "C://trial.csv", true, ",");
    

    Let me know if this solves your issue.

    Regards
    Sumitra
  • Hi Sumitra,
    I hope that this will write the file at the end of all the checking process. If the script stops/breaks, I would not get the report file. Am I correct? Please advice.
  • Hi Lawrence,

    Yes, this will write into CSV file.

    Yes,if your script stops/breaks in case then nothing will be written into he CSV file.

    Let me know if you face any problem.

    Regards
    Sumitra
  • Hi Sumitra,

    I need the report even the script stops/breaks. If we can not write the file without a reference value, we may close this post.
  • narayannarayan Administrators
    Hi Lawrence,

    You can use onScriptEnd() method to always execute some steps at the end of a script.
    Please have a look at Call back Functions: http://sahi.co.in/w/sahi-call-back-functions

    Regards,
    Narayan
  • Hi Narayan,
    Thanks.
This discussion has been closed.