Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
branches plist to csv
#!/usr/bin/env ruby
require 'plist'
require 'json'
require 'csv'
header = ['city_name', 'type', 'address', 'branch_name', 'lat', 'lon', 'phone']
csv = CSV.open('branches.csv', 'w', {force_quotes: true}) do |csv|
csv << header
Plist::parse_xml('Branches.plist').each do |name, cities|
cities.each do |c|
csv << (c.values.unshift name)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment