cancel
Showing results for 
Search instead for 
Did you mean: 

Create CSV file from DataSink (subreport type) using Groovy script

SOLVED
Highlighted
Occasional Contributor

Create CSV file from DataSink (subreport type) using Groovy script

Hi,

We want to create CSV file using Groovy script from DatSink Subreport data.

DataSInk's subreport has some data as shown below..subreport.png

 

Now, we want to create CSV file form this Subreport after testcase execution is done using teardown groovy script. We do not wish to change DataSink report type to something else, i.e Excel or file. We want to use subreport datasink type and export it to CSV.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

Re: Create CSV file from DataSink (subreport type) using Groovy script

You can set the DataSink type as "File" and then write value to CSV file. For this, you just need the basic java code for writing data to excel .CSV format using CSVWriter interface.

 

https://examples.javacodegeeks.com/core-java/writeread-csv-files-in-java-example/

 

For DataSink type as SubReport, I guess you cannot generate CSV file.

View solution in original post

2 REPLIES 2
Super Contributor

Re: Create CSV file from DataSink (subreport type) using Groovy script

You can set the DataSink type as "File" and then write value to CSV file. For this, you just need the basic java code for writing data to excel .CSV format using CSVWriter interface.

 

https://examples.javacodegeeks.com/core-java/writeread-csv-files-in-java-example/

 

For DataSink type as SubReport, I guess you cannot generate CSV file.

View solution in original post

Occasional Contributor

Re: Create CSV file from DataSink (subreport type) using Groovy script

Thanks Smiley Happy