Created
January 4, 2013 10:34
-
-
Save alex-cellcity/4451560 to your computer and use it in GitHub Desktop.
branches plist to csv
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
#!/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