Generating Licenses from Google Spreadsheet
This guide explains how to generate licenses from a Google spreadsheet, which are then saved back into the Google spreadsheet.
Instructions
1. Creating the credential.json from Google Spreadsheet
- Go to: https://console.cloud.google.com/, in the Select project menu, click on New Project, name it, and click CREATE.
- Once the project is created, open the menu in the top left corner, go to APIs & Services, and click on ENABLE APIS AND SERVICES.
- Open Google Sheets API and click ENABLE.
- In the left-side menu, go to Credentials and click CREATE CREDENTIALS, selecting Service account.
- After creating it, you’ll see a new entry under Service Accounts. Copy the email address in the new row.
- Click on the displayed email address, then in the Keys section, click ADD KEY and select JSON. This will download a .json file, which you should rename as credential.json.
2. Sharing the Google Spreadsheet
- Open the Google spreadsheet you want to use for generating licenses.
- In the top right corner, click Share and in the People section, enter the email address you copied in the previous step.
- Set the permission to Editor.
3. Downloading the Scripts
- Download the thumbnail generator and the license generation script from Google spreadsheet.
- Install dependencies.
- Start the thumbnail generator with the command pnpm start.
4. Running the License Generation Script
- In the spreadsheet-script project, open /scripts/create_signatures_from_google_table.js.
- Set the projectSlug variable to your project.
- Set the projectId variable to your project’s ID.
- Set the spreadsheetId variable to the ID of your shared Google spreadsheet.
- Set the accessKey variable to the secretKey obtained from https://dash.screenshotone.com/access.
- Place the credential.json file in the scripts folder.
- Use node to run the script create_signatures_from_google_table.js.
- While generating licenses, the script will log signatureUuid values to the console, which are then saved into the Google spreadsheet.
- At the end, it will display the total number of generated licenses.