Last active
January 1, 2016 08:59
-
-
Save developer88/8121975 to your computer and use it in GitHub Desktop.
Export data to Excel in csv format
This file contains 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
# For windows only. | |
# | |
csv_string = CSV.generate(col_sep: ";", encoding: 'Windows-1251') do |csv| | |
csv << "Add some data" | |
end | |
send_data(csv_string.encode('Windows-1251'), type: 'text/csv; charset=windows-1251; header=present', disposition: "attachment", filename: "file_to_export.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment