Skip to content

Instantly share code, notes, and snippets.

@chsh
Created June 27, 2012 16:00
Show Gist options
  • Select an option

  • Save chsh/3005035 to your computer and use it in GitHub Desktop.

Select an option

Save chsh/3005035 to your computer and use it in GitHub Desktop.
Example for Axslx (xlxs generator modudle)
require 'rubygems'
require 'axlsx'
rows = [
[1, "abc", Date.parse('2012/6/28')],
[2, "xyz"]
]
pkg = Axlsx::Package.new
pkg.workbook do |wb|
wb.add_worksheet(name: 'Sheet1') do |ws|
rows.each do |row|
ws.add_row row
end
end
end
pkg.serialize "file.xlsx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment