Only available on Google Sheets
Motivation
You can share the Google Sheet with your customers or team members, and they can refresh the data themselves by simply clicking the refresh button. They do not need to register for Superjoin or manage an API key on their own. All the logic and API authentication are handled within the sample Apps Script function, making the process seamless for anyone using the sheet. This feature allows you to:- Maintain control over the API key.
- Ensure that customers can always access the latest data without needing to manually update it.
- Avoid the need for additional Superjoin registrations for each customer.
The refresh functionality applies only to sheets where only the initial data pull was done using Superjoin’s Google Sheet Add on. Once data has been imported into a sheet via Superjoin, anyone the spreadsheet is shared with can refresh that data using the API key provided by the owner, ensuring easy and seamless updates.
Step by Step Guide
Get an API Key 🔑
To use this feature, you need to obtain an API key from Superjoin, by contacting us at [email protected].
Store the API Key
To store your API key:

This securely stores your API key for use in the refresh function.
- Open your target spreadsheet in Google Sheets
- Navigate to Extensions > Apps Script
- In the Apps Script editor, click the Settings icon in the left panel

- Scroll down to the Script Properties section
- Click “Add script property”
- Set the property name as “API_KEY”
- Set the value to the API key provided by Superjoin support

Create the Apps Script Function for Refreshing Data
In this step, we will create a function to refresh the data in the active Google Sheet.In case you want to refresh multiple sheets, with a single click, you can use the follow the below instructions:Execute the below function to get all the sheet IDs along with their names, and then replace the sheetIds array with the sheet IDs you want to refresh in the 
Now paste the remaining code in the Apps Script editor:Do not forget to save the Apps Script file after making the changes, using the Floppy icon. 
The
sheetId used in this function refers to the ID of the active sheet where the Apps Script editor is opened. This means the function will refresh data for the currently active sheet. If you’re working on a specific sheet in the editor, the refresh will be applied to that sheet alone.Refresh Data for Active Sheet
refreshDataForMultipleSheets function.Get All Sheet IDs

Refresh Data for Multiple Sheets

Insert a Button in the spreadsheet
Go to the Insert menu of the same spreadsheet. Select Drawing from the dropdown options. In the drawing editor, create a rectangle and add text, such as “Refresh Data”. You can customize the appearance as per your preference.

Assign the refresh function to the Button
After inserting the button, click on the three dots in the top-right corner of the button and select Assign Script. In the dialog box that appears, enter the name of the function (e.g., 
refreshData). Click OK to assign the function to the button.In case, you are refreshing multiple sheets, use the script name as
refreshDataForMultipleSheets
Need more help?
If you need more help, you can always contact us at [email protected].