HP UFT API Test - Saving Response/Checkpoint values
I was facing the same challenge and found the above thread but, I am trying to figure out the below.
How can I print different response values in a separate column in Excel.
I have 4 responses I was able to add the first one and it shows up properly in excel.
When I added the second response value it prints in either the same cell or if I put both response vaules in a seperate line it prints in a seperate cell but in one row and I need each response to print in it's seperate column.
ID | PersonName | Address | ZipCode
When you go to Write to File under property Tab there is only one field for Content so I can add muiltiple outputs under Expressions but, they all export in a same row.
I am working with Rest and Json UFT-API version 12.52
Any ideas?
UPDATE 1: @ManishChristian
Thanks Manish. I am not able to execute the script. my sheet is located on my desktop so I am assuming that there is no need to add the sql info or connect to database.
This is what my code looks like:
string price;
price = this.CodeActivity50.Input.Amount.ToString();
System.Data.OleDb.OleDbConnection MyConnection;
System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
string sql = null;
MyConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='C:\\Users/Batman/Desktop/sendAmount.xlsx';Extended Properties=Excel 12.0;Persist Security Info=False");
MyConnection.Open();
myCommand.Connection = MyConnection;
sql = "INSERT into [Sheet1] (COLUMN1) values('" + price + "')";
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
MyConnection.Close();
Error thrown:
The Microsoft Access database engine could not find the object 'Sheet1'. Make sure the object exists and that you spell its name and the path name correctly. If 'Sheet1' is not a local object, check your network connection or contact the server administrator.
My sheet name is set to Sheet1