Skip to content

Instantly share code, notes, and snippets.

@stevendaniels
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevendaniels/f70134e8bfc06b3e3ba4 to your computer and use it in GitHub Desktop.
Save stevendaniels/f70134e8bfc06b3e3ba4 to your computer and use it in GitHub Desktop.
Roo .to_csv method
irb(main):001:0> require "roo"
true
irb(main):002:0> require "roo/version"
true
irb(main):003:0> Roo::VERSION
"2.0.0"
irb(main):004:0> filename = './quotes.ods'
irb(main):005:0> sheet = Roo::Spreadsheet.open(filename, extension: 'ods')
{[1, 1]=>"id", [1, 2]=>"quote", [2, 1]=>1.0, [2, 2]=>"\"Hello\"", [3, 1]=>2.0, [3, 2]=>"\"world\""}
irb(main):006:0> sheet.to_csv
"\"id\",\"quote\"\n1,\"\"Hello\"\"\n2,\"\"world\"\"\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment