Last active
December 12, 2020 22:43
-
-
Save triangletodd/e36b111cd4ff93fb26f8 to your computer and use it in GitHub Desktop.
GDrive to YAML
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 'pry' | |
require 'yaml' | |
require 'google_drive' | |
GDRIVE_USER = ENV['GDRIVE_USER'] || raise('Please set the GDRIVE_USER environment variable') | |
GDRIVE_PASS = ENV['GDRIVE_PASS'] || raise('Please set the GDRIVE_USER environment variable') | |
YML_FILE = 'apple_app_info.yml' | |
data = {} | |
session = GoogleDrive.login(GDRIVE_USER, GDRIVE_PASS) | |
worksheet = session.spreadsheet_by_key('1ZFVvuAgsjU8Nu-sQ2IzgTriHJU8LwKNRaddczrz4IHA').worksheets[0] | |
binding.pry | |
worksheet.rows.each do |item| | |
data[item[1]] = { | |
'apple_id' => item[2].to_s, | |
'sku' => item[3].to_s, | |
'shortname' => item[4].to_s | |
} | |
end | |
file = File.open(YML_FILE, 'w') | |
file.puts(data.to_yaml) | |
file.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment