Skip to content
Read google spreadsheet and generate translation files out of it
Find file
Pull request Compare This branch is even with wooga:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Read a google spreadsheet and generate translation files into a target directory as JSON files. It uses the googles JSON api as opposed to the XML api. That means that one has to publish the doc in order to get the spreadsheet id. At some point, it makes sense to use the more powerfull XML API using credentials to load the spreadsheet.


gem install urbane


require 'urbane'

spreadsheet_id = '0Amfbd9df0sdflkewsd09dsfkl328sdf02'
target_dir = '/tmp/translations'
file_name = 'text_ids.json'

# the keys define the column headers in the spreadsheet
# the values define the name of the folder for a given language
languages = {
  :english => 'en',
  :german => 'de',
  :french => 'fr',
  :italian => 'it',
  :turkish => 'tr',
  :spanish => 'es',
  :portuguese => 'pt'
  :spreadsheet_id => spreadsheet_id,
  :target_dir => target_dir,
:format => :json,
  :file_name => file_name,
  :languages => languages,
  :fallback_language => :english

Output format

Support for YAML, JSON, XML and Apple Strings Files

VALID_FORMATS = [:json, :yaml, :xml, :apple_strings]

Output structure

    - en
        - text_ids.json
    - fr
        - text_ids.json


A google spreadsheet

For now it needs to have a certain format. Check the demo document. You have several sheets in one document

A google spreadsheet id

  1. Create a spreadsheet on google docs
  2. Click on File -> Publish To The Web
  3. Check 'Automatically republish when changes are made'
  4. Find the spreadsheet id in the generated link. It is marked with 'key='. In the following url, the key would be '0Auo5c2PWMqR4dHlOSjlXcjY0X01udzNPdHlKZ09QTVE':
  5. Click on the close button
Something went wrong with that request. Please try again.