Skip to content

Instantly share code, notes, and snippets.

@alex-cellcity
Created January 4, 2013 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-cellcity/4451560 to your computer and use it in GitHub Desktop.
Save alex-cellcity/4451560 to your computer and use it in GitHub Desktop.
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