Created
November 29, 2018 06:20
-
-
Save ahmad19/a50c694aa670b809b965d9f2febac9bd to your computer and use it in GitHub Desktop.
Read CSV and return as Array of hashes
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
# Using ruby's inbuild CSV library | |
data = [] | |
CSV.foreach(file_path, headers: true) do |row| | |
data << Hash[row] | |
end | |
data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment