I'm working with the Podio application, and I made a tiny little script to grab data from my Podio database and put in an xlsx file, and convert it to a csv using roo.
xlsx = Podio::Item.xlsx( <app_number>, options = {} )
fname = "blah.xlsx"
somefile = File.open(fname, "w")
somefile.puts xlsx
somefile.close
xlsx_data = Roo:Spreadsheet.open(fname)
csv = xlsx_data.to_csv
puts csv
So this works, but printing to a file, only to grab the data back again and convert it to a csv seems...sloppy. Is there a way to not print it to a file, put it in a variable, and then convert it to a csv so I'm not printing files?
I tried using StringIO.new to the output from Podio::Item.xlsx, but I got this as a response:
file = StringIO.new(xlsx)
`extname': no implicit conversion of StringIO into String (TypeError)
Didn't see anything about this in the Podio docs: https://developers.podio.com/doc/items/get-items-as-xlsx-63233 It just mentioned how to export an xlsx file, not what to do with it afterwards.
Any thoughts?