json2csv icon indicating copy to clipboard operation
json2csv copied to clipboard

Can i save data in different sheets of same csv ?

Open sarvagayatri opened this issue 8 years ago • 2 comments

I am having some data, where i need to save data in different sheets based on my custom filter. how can i achieve with this package?

sarvagayatri avatar Mar 24 '18 10:03 sarvagayatri

Hi,

AFAIK, CSV format doesn't support multiple sheets per file. So it's not a limitation of this library but a limitation of the format itself.

I assume that what you want is that each sheet goes to its own CSV file, correct? For that, I'd recommend that you filter your JSON array and then call multiple times json2csv to produce multiple CSV files. That's trivial to do using node.js. Using the CLI might be a bit more challenging but nothing that can't be achieved by using a JSON parser like jQ.

Please close the issue if this answers your questions or let me know if there is anything else that I can help you with.

juanjoDiaz avatar Mar 24 '18 14:03 juanjoDiaz

I'll close this since I think that my response answers your question. Feel free to reopen if you think that there is anything else that we could do 🙂

juanjoDiaz avatar Apr 02 '18 18:04 juanjoDiaz