Ask a Question

Add data to excell file with datasink without deleting existing data

Occasional Contributor

Add data to excell file with datasink without deleting existing data

I have an excel file that already contains data. I would like to add data to the file, so I use datasink.

But the problem is with the datasink that he deletes the existing data in the excel file.

Can this be bypassed?




Unfortunately, appending to an Excel file isn't supported. But, we have a corresponding feature request in our DB: "Add possibility to append data to a single Excel file from several DataSinks".

In the meantime, you can use DataSink of the File type, save the data to a single .csv file (enable the "append to existing file" option for that), and work with the resulting .csv file in Excel.


If it is important for you to use the excel I can offer you the workaround You need to add the below Groovy script to the Setup Script for each of your TestCases, and add a new property to TestSuite. Also, please take into account that this script works with a file of Excel type of Microsoft Office 1997-2003.
 import jxl.*

  def f = new File("FullPath to .xls file")
  def wk = Workbook.getWorkbook(f)
  s1 = wk.getSheet("SheetID")
  String rows = s1.getRows()+1
  testRunner.testCase.testSuite.setPropertyValue("row", "A"+rows)

Kirill Zakharov
Customer Care Team

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Member

In datasink test step,  Did you select the checkbox for'Append to end of file'?



Showing results for 
Search instead for 
Did you mean: