Last active
June 6, 2022 18:40
-
-
Save emailrhoads/0d8e3206cc6f21663e3c3c4b85159ad5 to your computer and use it in GitHub Desktop.
[Ruby array of hash to csv] #ruby
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
| CSV.open("data.csv", "w", headers: array_of_hashes.first.keys) do |csv| | |
| array_of_hashes.each do |h| | |
| csv << h.values | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment