Created
July 21, 2011 02:16
-
-
Save pjkelly/1096375 to your computer and use it in GitHub Desktop.
Converting JSON to Google Spreadsheets
This file contains hidden or 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
require 'rubygems' | |
require 'yajl' | |
require 'to_google_spreadsheet' | |
json = File.new('sizes.json', 'r') # file with more than one json | |
parser = Yajl::Parser.new | |
data = parser.parse(json) | |
GoogleSpreadsheet.config do |c| | |
c.email = "[email protected]" | |
c.password = "secret" | |
c.default_spreadsheet = "secret" | |
end | |
data.to_google_spreadsheet("Sizes") |
This file contains hidden or 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
[{ | |
"name": "S", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 2, | |
"id": 1, | |
"position": 1, | |
"created_at": {} | |
}, | |
{ | |
"name": "M", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 2, | |
"id": 2, | |
"position": 2, | |
"created_at": {} | |
}, | |
{ | |
"name": "L", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 2, | |
"id": 3, | |
"position": 3, | |
"created_at": {} | |
}, | |
{ | |
"name": "XL", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 2, | |
"id": 4, | |
"position": 4, | |
"created_at": {} | |
}, | |
{ | |
"name": "XXL", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 2, | |
"id": 5, | |
"position": 5, | |
"created_at": {} | |
}, | |
{ | |
"name": "Men's M", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 3, | |
"id": 6, | |
"position": 1, | |
"created_at": {} | |
}, | |
{ | |
"name": "Men's L", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 3, | |
"id": 7, | |
"position": 2, | |
"created_at": {} | |
}, | |
{ | |
"name": "Women's S (Pink Only)", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 3, | |
"id": 8, | |
"position": 3, | |
"created_at": {} | |
}, | |
{ | |
"name": "Women's M (Pink or Grey)", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 3, | |
"id": 9, | |
"position": 4, | |
"created_at": {} | |
}, | |
{ | |
"name": "Women's L (Pink or Grey)", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 3, | |
"id": 10, | |
"position": 5, | |
"created_at": {} | |
}, | |
{ | |
"name": "M Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 11, | |
"position": 1, | |
"created_at": {} | |
}, | |
{ | |
"name": "L Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 12, | |
"position": 2, | |
"created_at": {} | |
}, | |
{ | |
"name": "Teen Long Sleeve - S", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 13, | |
"position": 3, | |
"created_at": {} | |
}, | |
{ | |
"name": "Teen Long Sleeve - M", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 14, | |
"position": 4, | |
"created_at": {} | |
}, | |
{ | |
"name": "Teen Long Sleeve - L", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 15, | |
"position": 5, | |
"created_at": {} | |
}, | |
{ | |
"name": "Adult T - S", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 16, | |
"position": 6, | |
"created_at": {} | |
}, | |
{ | |
"name": "Adult T - M", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 17, | |
"position": 7, | |
"created_at": {} | |
}, | |
{ | |
"name": "Adult T - L", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 4, | |
"id": 18, | |
"position": 8, | |
"created_at": {} | |
}, | |
{ | |
"name": "7 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 19, | |
"position": 1, | |
"created_at": {} | |
}, | |
{ | |
"name": "8 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 20, | |
"position": 2, | |
"created_at": {} | |
}, | |
{ | |
"name": "9 kids", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 21, | |
"position": 3, | |
"created_at": {} | |
}, | |
{ | |
"name": "10 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 22, | |
"position": 4, | |
"created_at": {} | |
}, | |
{ | |
"name": "11 kids", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 23, | |
"position": 5, | |
"created_at": {} | |
}, | |
{ | |
"name": "12 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 24, | |
"position": 6, | |
"created_at": {} | |
}, | |
{ | |
"name": "13 kids", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 25, | |
"position": 7, | |
"created_at": {} | |
}, | |
{ | |
"name": "14 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 26, | |
"position": 8, | |
"created_at": {} | |
}, | |
{ | |
"name": "15 kids", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 27, | |
"position": 9, | |
"created_at": {} | |
}, | |
{ | |
"name": "16 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 24, | |
"id": 28, | |
"position": 10, | |
"created_at": {} | |
}, | |
{ | |
"name": "7 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 29, | |
"id": 29, | |
"position": 1, | |
"created_at": {} | |
}, | |
{ | |
"name": "8 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 29, | |
"id": 30, | |
"position": 2, | |
"created_at": {} | |
}, | |
{ | |
"name": "10 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 29, | |
"id": 31, | |
"position": 3, | |
"created_at": {} | |
}, | |
{ | |
"name": "12 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 29, | |
"id": 32, | |
"position": 4, | |
"created_at": {} | |
}, | |
{ | |
"name": "14 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 29, | |
"id": 33, | |
"position": 5, | |
"created_at": {} | |
}, | |
{ | |
"name": "16 Child", | |
"is_visible": false, | |
"updated_at": {}, | |
"product_id": 29, | |
"id": 34, | |
"position": 6, | |
"created_at": {} | |
}, | |
{ | |
"name": "4 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 30, | |
"id": 35, | |
"position": 1, | |
"created_at": {} | |
}, | |
{ | |
"name": "5 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 30, | |
"id": 36, | |
"position": 2, | |
"created_at": {} | |
}, | |
{ | |
"name": "6 Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 30, | |
"id": 37, | |
"position": 3, | |
"created_at": {} | |
}, | |
{ | |
"name": "6X Child", | |
"is_visible": true, | |
"updated_at": {}, | |
"product_id": 30, | |
"id": 38, | |
"position": 4, | |
"created_at": {} | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment