How to export json or HTML datas to csv or excel

I want to download json or html datas to csv or excel file, please help meā€¦

Hey @venkateshm2280

Welcome to the community :wave:

Iā€™m unsure of what context you would need to do that in -

Are you able to provide more information around your current workflow and the data you are trying to download, please?

Thanks for your reply.
I would like to download the Json datas in the attached image to Excelā€¦

Youā€™re not currently able to export the response data, in that format, from the features with in the app.

You could use the Send and Download option (The downdown option on the right side if the Send button) to save the response body data to a JSON file but not in a CSV.

Small projects have been created to utilise the sendRequest() function in the Pre-request Scripts to write the response data to a .csv file.

All the details for this can be found here:

This might not be exactly what youā€™re looking for but it might get you closer to a solution.

1 Like

Sir,

Thanks for the information. Is there is any way to call post web service using PHP.

I tried the ā€œWrite Responses to Fileā€ and the script.js option to change the file extension defaultFileExtension = ā€˜csvā€™, // Change the default file extension and it doesnā€™t seem to work even though I changed the file format and restarted the server and it is still outputting JSON files. Any ideas?

Hello All,

Do you know if there is a way to export results to csv files?

Regards.

@axelcast

The Postman sandbox does not have native access to the local file system.

Itā€™s not what the tool was designed to do.

There are some work arounds, but they require you to have a local API ready to accept the data.

If you use the Newman command line tool to run your tests, then this will generate a report that shows the test run and whatever failures you have.

Running collections on the command line with Newman | Postman Learning Center

There is a HTML extra library that gives more in-depth reports.

newman-reporter-htmlextra - npm (npmjs.com)

Combine Newman with your favourite CI (continuous integration) tool and you should be able to get your test results saved back to the CI tool. (For example, back into Azure Test Plan runs).

If you canā€™t create a local API to send your data to, consider using a Cloud based service like SharePoint which has its own API. Store your results in an array, and in the Tests tab of the last request, use sendRequest() to save the results to a SharePoint list via the SharePoint API.

If you really want to create CSV files within the local file system, consider a scripting language like PowerShell. You can use Invoke-Webrequest and Export-CSV to your hearts content. (This is how I would do this if it wasnā€™t directly related to testing, in which case I would use the CI tool to store the results).

This reporter by @matt is also available to generate a CSV-based output from a Newman run:

CLI flags can be used to include the response body of the request, in a column:

1 Like