How to Update Member Data Using API: Google Sheets Example
This article shows an example of how a Google Spreadsheet can be used to update member data on a site using the site's API.
Checklist Before Moving Forward With This Example
- Make sure to generate a unique API Key using the documentation down below as a guideline. Please make sure to save the API Key in a safe place as it is not accessible after it has been created: How To Generate an API Key
- Prepare a Google Spreadsheet with at least two essential column, one for the member's ID# (the user_id variable) to reference an existing member on the site, and the second for the variable to be updated.
For example: if a member is currently in a membership plan with ID#1 and needs to be updated to plan ID#2, specify these details in the spreadsheet.
Note: The user_id variable is the only mandatory field for this process, and multiple data points can be updated simultaneously.
When setting up the file we recommend using our CSV import template file as a basis for the API sheet. The file has all of the correct database variables:
However, the column names do not necessarily match with the correct database variable names as this can be mapped later on.
How To Connect Google Sheets Using Zapier
In this example, we will be using Zapier to integrate Google Sheets into the Brilliant Directories site.
Log in to the Zapier account and click on Create Zap:
Name the new zap created and select the Google Sheets option as a Trigger:
Select the Event type as New Spreadsheet Row and click on Continue:
Connect the Google Sheet Account (this would be a Gmail account) and click on Continue:
Choose the preferred Spreadsheet, specify the Worksheet and click on Continue:
Click on Test Trigger:
There will be a confirmation that a spreadsheet row has been found, click Continue:
Now the Trigger has been set up correctly, the Action can be created. Search and select the "Brilliant Directories" as the App option:
Choose the Update User event and click Continue:
If this is the first time creating a Brilliant Directories connection, click on the Sign In option:
If there is already a connection created to Brilliant Directories, click on Connect a new account option:
Clicking both options above will open a new window where the domain of the site (https:// or http:// included) and the API Key generated can be specified:
After clicking Yes, Continue on the window above, click on Continue:
Next, we will be setting up the action. In this section, all the available member variables can be found. As we already created a spreadsheet with a row of member information, the next action would be mapping/matching the column names to the correct variable names.
First, map the User ID variable by clicking on Custom and selecting the related column in the spreadsheet:
Then, map the Membership Plan ID# by selecting the subscription_id column for the "ACCOUNT: Membership Plan ID" field:
Now that all the preferred variables are matched and mapped correctly, click on Continue to test the action:
Confirm that the information displayed is correct and click on Test Step:
This will update the targeted member data on the fly:
BEFORE | AFTER |
Click on Publish:
Note: Going forward, any new rows added to the connected Google Sheet via the API will automatically update the corresponding member data.