Skip to content

Instantly share code, notes, and snippets.

@dentarg
Created April 27, 2014 15:18
Show Gist options
  • Select an option

  • Save dentarg/11348184 to your computer and use it in GitHub Desktop.

Select an option

Save dentarg/11348184 to your computer and use it in GitHub Desktop.
require 'csv'
require 'open-uri'
file = "Workbook3.csv"
content = CSV.read(open(file), encoding: 'ISO-8859-1:UTF-8', col_sep: ";")
File.open("output.csv", "w") do |f|
rows = content.map { |row| "\"#{row.join('","')}\"" }.join("\n")
f.puts(rows)
end
@dentarg
Copy link
Copy Markdown
Author

dentarg commented Apr 27, 2014

@henri
Copy link
Copy Markdown

henri commented Jul 16, 2025

Super handy thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment