Skip to content

Instantly share code, notes, and snippets.

@dvrensk
Created March 2, 2018 15:14
Show Gist options
  • Save dvrensk/4d28cfb453c1000f98ba774cf44be937 to your computer and use it in GitHub Desktop.
Save dvrensk/4d28cfb453c1000f98ba774cf44be937 to your computer and use it in GitHub Desktop.
def xls(name: "Workbook-#{Time.current.strftime("%Y-%m-%d--%H-%M-%S")}.xlsx")
package = Axlsx::Package.new
sheet = package.workbook.add_worksheet(name: "Sheet 1")
yield sheet
package.serialize(name)
system("open", name) if RUBY_PLATFORM.match("darwin")
name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment