Altair: Download As CSV

Created on 24 Mar 2020  路  10Comments  路  Source: imolorhe/altair

We have data in our system that certain users need access to in CSV format. Rather than building a very complicated export system, we thought: what if we taught these few people graphql?! Then they could build very powerful queries for the data that they need.

To make their experience seamless, though, ideally Altair would provide a CSV download option, just like it provides JSON download.

Describe the solution you'd like

We would like a "Download as CSV" button available, next to the current "Download" (as JSON) button. Alternatively, a single button could then give an option to select "CSV" or "JSON". (I suppose XML could also be interesting, but CSV is what we really need.)

There are json-to-csv node packages available.

Describe alternatives you've considered

One option we have is to just tell the users to paste the JSON into https://json-csv.com/. But we figured a download-as-CSV button in Altair would be more user-friendly, and might be an addition that would be useful for others.

Plugin

Most helpful comment

I believe @isaachvazquez has created a plugin for this, so I'd be closing this issue now.

All 10 comments

Hey @benhutton :wave:,

Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our Open Collective and consider backing us - every little help counts!

Hey @benhutton, thanks for the issue. Indeed this could be a useful feature for other users. I'd consider extending the plugin system to allow adding actions to the server response. That should make it easy to create a plugin for that use case 馃檪

@imolorhe that would be awesome!

Is there documentation somewhere on how to write plugins?

Current'y there's no documentation for the plugin system because it's still in beta. The only documentation that exists is in #1089 when I was explaining how to create one.

@imolorhe we love this idea. Any idea when you plan on releasing the plugin system for this use case?

Within the coming month.

I just realized, JSON isn't directly translatable to CSV. CSV format is more for managing a list of items. How would you expect to figure out how to parse a JSON object in one click?

Check out https://json-csv.com/, or https://www.npmjs.com/package/json2csv

Convert JSON to CSV. Upload JSON file, url or text. View in Excel or Open Office.
npm
Convert JSON to CSV

I already checked out json2csv and tried it out as well. The result was just data as heading and the whole json object as a single value as a string. Don't think that is what you would be expecting.

Anyway, the plugin capability for this has been released. A plugin can now be developed to add the button.

I believe @isaachvazquez has created a plugin for this, so I'd be closing this issue now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imolorhe picture imolorhe  路  3Comments

MCSH picture MCSH  路  7Comments

DaniloCaruso picture DaniloCaruso  路  3Comments

sneko picture sneko  路  10Comments

XAKEPEHOK picture XAKEPEHOK  路  8Comments