Creating an API Key is necessary to use Singular Google Widgets such as the Google Sheets Widget. The following is a tutorial on how to create an API Key.
1. Create a Project
Creating a new project is not necessarily required. You can skip this step if you want to use an existing project and continue with Enable Google Sheets API.
Open Google Chrome and log into your Google Account. Create a project, here, and define a project name e.g., “Google Charts Widget” or whatever you want to call it.
Creating the project can take one or two minutes. Your project will be listed in the Cloud Resource Manager.
2. Enable Google Sheets API
Open Google Chrome and log into your Google Account. Next, open the Google Developer Console and select your project.
Search in the toolbar for "Google Sheets API" and add it.
Next, enable “Google Sheets API”.
3. Generate an API Key
There are a few steps in your Google account to start, specifically generating a Google API key. Essentially the API is the code or "key" that governs the access point(s) between Singular's Google Widgets and Google.
Open the “Credentials” menu for your project. Note, your project is listed in the top toolbar.
Select “Create Credentials” and then hit “API key”.
Next, select “Restrict Key”.
Then, select "HTTP referrers (web sites)" in the Application restrictions menu.
Next, in the Website restrictions section, hit "Add an Item" and type in two new items (as seen pictured below):
Define API restrictions. Select your Google Sheets API.
Save your settings.
Now you can select the clipboard icon to the right of your newly created Google Sheets Widget API key to copy it. You'll need this for use in Google type Singular Widgets.
About Quota Limits
It is important to be aware that Google defines a quota of 500 requests per 100 seconds for each API key.
This sounds a lot but if you are using multiple Google Sheet widgets in a single Composition, you could hit this limit. In these cases, Google prints tons of error messages in the console indicating the issue.
You can avoid running into API quotas by:
- Reducing the number of Google Sheet Widgets in the same Composition
- Reducing the refresh frequency and increasing the duration between requests
- Reducing the number of Output URLs to a minimum
- Using multiple API keys