Ask a Question

Is it possible to get Data Sink to write output to excel file horizontally and not vertically?

SOLVED
axasmgaxa
Occasional Contributor

Is it possible to get Data Sink to write output to excel file horizontally and not vertically?

Hi Folks,

 

I have soap test that is looping through a few iterations, each time, it writes output via a datasink to an excel file.

The problem is, I would like the data to be written out to cells in a horizontal fashion, (e.g. cells A1, B1, C1) and not in a vertical fashion (e.g. A1, A2, A3) as seems to be default.

 

Many thank in advance for any help,

 

Steven.

6 REPLIES 6
sonya_m
SmartBear Alumni (Retired)

Hi @axasmgaxa , that is an interesting question!  

 

@nmrao@jsheph01@richie , what do you think? Is there any way to implement this? 


Sonya Mihaljova
Community and Education Specialist

Hi,

 

I went through the Data Sink function a couple of days ago trying to find an option that would translate the writing into the file from vertical to horizontal.

I went through every file type and every option I could see.  Its a looping testcase right, so I even thought about trying a condiitional goto or maybe some other overcomplicated and ridiculous way of doing it (e.g. using a DataSource grid feeding off a Properties step and the DataSink sources the values from the grid) - but I couldn't find an option.

 

Unless one of the other fellas knows how to do this, I think the option likely to solve this is groovy script (so this counts me out).  I was thinking perhaps allow the DataSink step to write out the values as normal and then use a bit of groovy to translate the values.  I did have a quick search, but I couldn't find any groovy methods that would do this.

 

Sorry I couldn't be more help,

 

rich

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
jsheph01
Contributor

As richie has said there is no built in option to do this. Depending on what you plan to do with the spreadsheet I can think of 2 ways that might work. I have not tried either one so I cant guarantee they will work, but it should be a step in the right direction.

 

The first option is to use the transpose function built into excel. I think you should be able to write the data to one worksheet and use the transpose funtion in another worksheet to flip the data. I'm not sure what versions support this so you might have to see if this will work for the version you are using.

https://support.office.com/en-us/article/transpose-rotate-data-from-rows-to-columns-or-vice-versa-34... 

 

The other option is to use groovy. You can read the data from the data sink and then write the data to the next column. I tried doing something similar to this some time ago but scrapped the idea because of how long it took to read and write from a excel file. If you go this route you will need to download the jxl jar and add it to bin/ext.

https://learnsoapui.wordpress.com/tag/soapui-excel-export/ 

 

nmrao
Champion Level 3

No idea about datasink.

But found a video link where datasink is explained (starting from 4:00 onwards). Please checkout if that is what you are after
https://www.youtube.com/watch?v=6g0uHvOy8BM


Regards,
Rao.
axasmgaxa
Occasional Contributor

Thanks to everyone who has responded. 

I don't think it is possible via datasink. (it certainly maybe possible through Groovy, but I am not very proficient with that as of yet.)

 

As a work around, I reshuffled the excel sheet so it will expect the response in vertically.

sonya_m
SmartBear Alumni (Retired)

Wow! Thank you for reacting so quickly and being so helpful richie, jsheph01, nmrao. This is very much appreciated Smiley Happy

 

Hi @axasmgaxa, I am glad to hear you found a workaround.

 

 


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: