Skip to content

Instantly share code, notes, and snippets.

@doyle
Created July 5, 2018 20:34
Show Gist options
  • Save doyle/557fba170fdff7c46126061c15331339 to your computer and use it in GitHub Desktop.
Save doyle/557fba170fdff7c46126061c15331339 to your computer and use it in GitHub Desktop.
How to read the headers of a CSV file without reading the whole file
header_string = File.open(file_path, 'r:bom|utf-8', &:readline)
headers = CSV.parse(header_string).first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment