Closed XanderZhu closed 4 years ago
@jvigne What do you think about adding a parameter --export-all-sheets
?
For now the only workaround is:
for sheet_id in sheet_ids do
bundle exec ad_localize -k <your-spreadsheet-drive-key> -s sheet_id
done
After digging, using Spreadsheet API to list available sheets inside a file requires authentication.
ADLocalize user will have to create a project on the Google Cloud Console, enable Sheet API and provide the client_secret.json
when using ad_localize
. (similary to the way this PR works: https://github.com/applidium/ad_localize/pull/32)
@XanderZhu can you precise if you use the option -a with a google service account or if you just use the option -k ? Also, do you generate the wording for a specific set of platforms ?
@jvigne, at the moment I'm using -k option, but it isn't a problem to switch -a option using.
@XanderZhu You should be able to export all sheets from one spreadsheet.
Export wording from a private google spreadsheet using a Google Cloud Service Account. Create a GCloud Service Account: Go to Google Cloud Console Either create a new project or use an existing one (when using Firebase, a GCloud project is created) Go to IAM & Admin / Service Account and create a new service account. Store the created client-secret.json (in a password manager for example) Enable Google Drive API for the projet Go to API / Library and enable the Drive API there. Add the service account to a spreadsheet. In IAM & Admin / Service Account, the service account's email is listed. Invite it to the spreadsheet to export.
$ export GCLOUD_CLIENT_SECRET=$(cat <client-secret.json>)
$ bundle exec ad_localize -k <your-spreadsheet-drive-key> -a
Fetch and export all sheets from a google spreadsheet. (requires a Google Cloud Service Account) The Google Service Account's projet needs to have Google Spreadsheet API enabled.
$ export GCLOUD_CLIENT_SECRET=$(cat <client-secret.json>)
$ bundle exec ad_localize -k <your-spreadsheet-drive-key> -e
You need to use a Google Cloud Service Account because adlocalize will use the Google Spreadsheet API to fetch and download individual sheets.
@XanderZhu starting from version 4.0.0 the option -a
is not required to use Google Cloud Service Account as mention in the CHANGELOG. If you use it you will have an error.
To fix your call to ad_localize just remove the -a
but let the environment variable.
I have multiple localisation sheets in one spreadsheet (one sheet per feature). So, it will be convenient to generate localisation files from all sheets of my spreadsheet by calling
bundle exec ad_localize -k <your-spreadsheet-drive-key>
. But now this command generate localisation files only for the first sheet.