Easily restore your project to a previous version with our new Instant One-click Backup Recovery

Exporting Content From Hygraph to CSV in 3 Simple Steps

In this post, we'll take a look at how to export content from Hygraph using the Content API and a JSON to CSV converter.
Jamie Barton

Jamie Barton

Feb 08, 2022
Export Content from hygraph

Exporting content from Hygraph to CSV needn’t be a complex task.

It is often helpful to fetch content from your CMS to analyze marketing plans, perform an SEO audit, or evaluate current content. Hygraph makes it easy to fetch your content with the API Playground in a format that you can easily convert to CSV, and more.


Hygraph uses the JSON format as it’s response type for any API requests. The free online JSON to CSV Converter is an excellent way to convert the API standard “JSON” to CSV.


  1. Query (optionally filter results) using the API Playground
  2. Copy JSON result to your clipboard
  3. Paste JSON into JSON to CSV and “Download Result” as CSV


Teams do not need to write custom integration logic to fetch and sync content with other systems. With the JSON to CSV Converter, teams have full control over what data is returning, whether or not to use filters, and what the final converted format should be


Let’s explore fetching data as JSON, and filtering it, as well as exploring the UI for converting JSON to CSV.

#Fetching Content as JSON

Below we will query for “episodes”, and fetch only the fields I want inside my CSV.

undefined

The default result size of results returned by queries fetching multiple entries is 100. You can provide a maximum of 1000 to the first, or last arguments. If you need to fetch more results, you can page through data using the pagination filters.


#Filtering Content

If you only require a certain subset of content entries, add filters or pagination to the GraphQL query, and use the result to convert to CSV.


In the example below, we’ll fetch “episodes” where the position is within the range 1–10. We can use the gte and lte filters for this.

undefined

#Convert to CSV

Follow the steps to use the JSON to CSV Converter and you will be able to view the CSV results in the browser, or download as a file with a custom filename.

undefined

That’s it! You can now fetch as much content from the Content API, in whatever format you require, and convert to CSV.


If you are looking to do the opposite, and import CSV data into Hygraph, Jesse Martin posted on how you can use a free to use low-code approach to do just tha

Blog Author

Jamie Barton

Jamie Barton

Jamie is a software engineer turned developer advocate. Born and bred in North East England, he loves learning and teaching others through video and written tutorials. Jamie currently publishes Weekly GraphQL Screencasts.