Save API Response as Excel for Content-Type: application/ms-excel
Hi ,
I have an API whose Raw Response is as below
Request : GET {URL}?isActiveUser=true HTTP/1.1
Raw Response :
HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/ms-excel
Server: Microsoft-IIS/10.0
content-disposition: attachment; filename=AllUsers_Active.xls
X-AspNet-Version: 4.0.30319
Persistent-Auth: true
X-Powered-By: ASP.NET
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://url.com
Access-Control-Allow-Headers: Accept,Content-Type
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Date: Mon, 03 Jun 2019 14:42:21 GMT
<div>
<table cellspacing="0" rules="all" border="1" style="border-collapse:collapse;">
<tr>
<th scope="col">EmployeeNumber</th><th scope="col">FirstName</th><th scope="col">MiddleName</th><th scope="col">SurName</th><th scope="col">Phone</th><th scope="col">Title</th><th scope="col">RegionName</th><th scope="col">ReportsTo</th><th scope="col">ReportsToName</th><th scope="col">IsActive</th><th scope="col">Group</th>
</tr><tr>
<td>100221076</td><td>Pilu</td><td> </td><td>Goopos</td><td> </td><td> </td><td>Atlantic</td><td> </td><td>N/A</td><td>1</td><td> </td>
</tr><tr>
<td>100221845</td><td>Losedaci</td><td> </td><td>Siyezke</td><td> </td><td> </td><td>Atlantic</td><td> </td><td>N/A</td><td>1</td><td> </td>
</tr><tr>
<td>100224203</td><td>Euoxmi</td><td> </td><td>Olova</td><td> </td><td> </td><td>Atlantic</td><td> </td><td>N/A</td><td>1</td><td> </td>
</tr>
</table>
</div>
On UI , This API is used to save the Data of a Grid in Excel (based on the input Params)
As per other Forum Topics , in my Test Case i added a Property Transfer Step and Data Sink Step to save the API Response in Excel.
However , in the saved excel , I get all the API response Data in One Cell . Data is not structured as a grid .
Please see the document containing Prop Transfer and Data Sink settings and my excel output . Can you please help point out how to get the API response in Excel ?
Here is just a quick tip for you: saving a response content to a file can be done with the "Create File" step:
(the actual content has the html format rather than xls so Excel shows the warning when opening the file, but still can open it)