Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # open the CSV file in write mode and add headers
- CSV.open('products.csv', 'w', headers: true) do |csv|
- # write headers to the CSV file
- csv << ['Product Name', 'Price']
- product_data.each do |product|
- csv << [product[:name], product[:price]]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement