Created
October 6, 2022 11:20
-
-
Save isidzukuri/f29214ad1314aef8206dc087f29fd406 to your computer and use it in GitHub Desktop.
ruby generate csv from hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| CSV.open('name.csv', "wb") do |csv| | |
| csv << data.first.keys | |
| data.each do |row| | |
| csv << row.values | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment