INNER CODE UNIT · Ruby

download_themes

Automattic/pocket-casts-android · scripts/themes/download_themes.rb:77

def download_themes
  unless File.exist?(CREDENTIALS_PATH)
    puts "Download Google Sheet credentials 'google_credentials.json' from: https://developers.google.com/sheets/api/quickstart/ruby"
    return nil
  end

  # Initialize the API
  service = Google::Apis::SheetsV4::SheetsService.new
  service.client_options.application_name = APPLICATION_NAME
  service.authorization = Google::Auth::ServiceAccountCredentials.make_creds(
    json_key_io: File.open(CREDENTIALS_PATH),
    scope: Google::Apis::SheetsV4::AUTH_SPREADSHEETS_READONLY
  )

  # https://docs.google.com/spreadsheets/d/1BZWwQo8ZhTt9jRz5eX6iJqt4r9o6ekWeYi_t8AlNDCM/edit
  spreadsheet_id = '1BZWwQo8ZhTt9jRz5eX6iJqt4r9o6ekWeYi_t8AlNDCM'
  range = 'A3:AZ200'
  response = service.get_spreadsheet_values spreadsheet_id, range

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…