CsvSave in specific multiple columns

Hi guys. I normally run my automation tests in Katalon Recorder, but I was a bit frustrated with no functionality for writing certain text/values to a CSV file. I heard Kantu has that functionality but I am a bit confused on how to do it.

Basically, my scripts navigate through a website and type in variables from a CSV file into a data entry form. There is one thing I’d need implemented - once the data entry is done, it shows 2 sets of text that I would like automatically copied to separate columns which have specific names. This loops until all of the rows of the CSV were submitted.

Can this be done in Kantu? If so, how do I specify the CsvSave in specific columns?

Any help would be appreciated.

You can not save data back into the same CSV file that you read from, but you can create a new CSV file and store the old data in it, plus add two new columns:

(1) Read data

  • csvRead | testdata.csv => the values are now in ${!COL1}, ${!COL2} etc.

(2) Extract data from the website (the “2 sets of text” that you want to store). For this see web scraping

(3) Store results in new CSV. This uses the internal var !csvLine.

store |  ${!COL1} | !csvLine  (this is the data from the first CSV file)
store |  ${!COL2} | !csvLine
store |  ${!COL3} | !csvLine
store |  value1 | !csvLine (this is the extra data you extracted)
store |  value2 | !csvLine
csvSave | newdata.csv
1 Like

Thank you very much. It works perfectly well. :slight_smile:

Is it possible to save 2 columns with 1 line
what is the csv column separator?

{
“Name”: “Test”,
“CreationDate”: “2021-9-2”,
“Commands”: [
{
“Command”: “store”,
“Target”: “abc,def”,
“Value”: “!csvline”,
“Description”: “”
},
{
“Command”: “csvSave”,
“Target”: “test”,
“Value”: “”,
“Description”: “”
}
]
}

I want to save ‘abc’ & ‘def’ in separate columns with 1 line

{
“Name”: “Test”,
“CreationDate”: “2021-9-2”,
“Commands”: [
{
“Command”: “store”,
“Target”: “abc”,
“Value”: “!csvline”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “def”,
“Value”: “!csvline”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “alert (${!csvline});”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “csvSave”,
“Target”: “test”,
“Value”: “”,
“Description”: “”
}
]
}

I see comma as separator