Forum Discussion

mohamed_mansoor's avatar
mohamed_mansoor
Occasional Contributor
11 years ago

How to create a new excel sheet using jscript

Hi all,





I want to post the excuted result into the excel sheet for that i am manually create a excel then i am writting tested result using jscript 



I wan't avoid to that i need to automate for creating a excel file



Could you please do the needful



Thanks,

Mansoor

2 Replies

  • jusbat's avatar
    jusbat
    Occasional Contributor

    I'm not sure if this will help you, maybe you're already doing this, but this is the script I use to create an excel file and save my results.



    See this link - http://support.microsoft.com/kb/234774



          //Start Excel and get Application object.


          var oXL = new ActiveXObject("Excel.Application");


           


          oXL.Visible = true;


          


          //Get a new workbook.


          var oWB = oXL.Workbooks.Add();


          var oSheet = oWB.ActiveSheet;


          


          //Save values to a cell


          oSheet.Cells(1, 1).Value = "Something";



          //Save excel file and close


          oWB.SaveAs("C:\MyExcel.xlsx");


          oXL.Quit();




  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Mansoor,


     


    We have a suggestion to implement the possibility of exporting a TestComplete log to the Excel format in our DB - I've increased its rating based on your request.


     


    At the moment, you can use your approach or export the test result to the XML format and create an Excel file based on it.