Skip to content

Instantly share code, notes, and snippets.

@vmi
Last active September 10, 2019 03:20
Show Gist options
  • Save vmi/b8d135f0b252fbc8ee782a3ca49c073b to your computer and use it in GitHub Desktop.
Save vmi/b8d135f0b252fbc8ee782a3ca49c073b to your computer and use it in GitHub Desktop.
Snippet of writing Excel CSV (ja) by Ruby.
#!/usr/bin/ruby
require 'csv'
BOM = "\u{FEFF}"
CSV.open(filename, "w", encoding: Encoding::UTF_8) do |csv|
csv << [ BOM + header1, header2, ... ]
csv << [ cell1_1, cell1_2, ... ]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment