Forum Discussion
Hey! Maybe something like this will help you:
var values = [info coming from your app...]; function TextExcel() { var excel = Sys.OleObject("Excel.Application"); excel.DisplayAlerts = false; //No messages var book = app.Workbooks.Open("C:\\EXCELFILE"); //Path to your excel file var sheet = book.Sheets("Plan1"); //Name of the sheet for (x = 0; x < values.length; x++) { sheet.Cells(1, x+1) = values[x]; } book.Save(); app.Quit(); }
Could u update for VB Script
- AlexKaras8 years agoChampion Level 3
Hi,
Something like this (untested plain conversion of top of my head):
Dim values = Array(1, "aaa", "info coming from your app...")
Function TextExcel()
{
Dim excelDim book
Dim sheet
Dim x
Set excel = Sys.OleObject("Excel.Application")
excel.DisplayAlerts = False ' No messages
Set book = app.Workbooks.Open("C:\\EXCELFILE") ' Path to your excel file
Set sheet = book.Sheets("Plan1") ' Name of the sheet
For x = BuiltIn.VarArrayLowBound(values, 1) To BuiltIn.VarArrayHighBound(values, 1)
sheet.Cells(1, x+1) = values(x)
Next
Call book.Save()
Call app.Quit()
End Function- mgroen28 years agoSuper Contributor
Would be great if this functionality could be implemented in Keyword Driven Testing (KDT) as well!