SAMMI Extensions
Google Sheets
Access and manipulate data in your Google Sheets straight from SAMMI!
For instance, you can set up your own leaderboard and easily share it with others.
Features
Available Commands
- Get Data, Find Data
- Append Data, Update Data, Batch Update, Copy Paste, Clear Data
- Auto Fill, Auto Sort, Randomize, Find and Replace, Delete Duplicates, Split Text
- Merge Cells, Unmerge Cells, Insert Range, Delete Range
- Create Spreadsheet, Duplicate Sheet, Add Sheet
Limitations
This extension only works with public Google Spreadsheets that were created using it. It won’t be able to access or edit any of your other files.
There are limits on the number of read and write actions you can perform per minute (more details in the documentation).
Setup
- The extension only works with public spreadsheets created specifically with it. See how to make a spreadsheet public.
- Your read quota is 60 requests per minute, and it's exclusive to you (not shared with other users). There is no daily limit.
- Your write quota is 30 requests per minute (you can send batch requests that count as one), but it is shared with other extension users.
- The total quota is 300 requests per minute. The extension assumes no more than 10 users making 30 write requests per minute at the same time, though this might change in the future. No daily limit applies.
How It Works
The extension uses Google Sheets API endpoints to read and write data.
Reading data only requires an API key, while writing data is more complex. The extension uses a custom API to retrieve your refresh token, as this can only be done server-side and cannot be handled by your Bridge.
Initial Setup
Install the extension. You can follow the Extension Install Guide.
Configure INIT Settings button
You should see a new premade deck in your SAMMI. Right-click on the red INIT Settings button - edit commands.Refresh Token
- allows the extension to access your Google Sheets and retrieve the refresh token. Please use this link to authorize the extension, and follow the instructions after you get redirected.This only grants access to files created with the extension, with no permissions for other files.
If you get the 'Something went wrong' error, try opening the link in a different browser or incognito window. Firefox has been known to have issues at times.
API Key
- you will need your own Google API Key.
Follow the video guide showing the steps below:- Go to the Google Cloud Console.
- Select or create a project for the API key.
- In the menu, choose APIs & Services.
- Enable the Google Sheets and Google Drive APIs.
- Create an API key under APIs & Services > Credentials.
- Optionally restrict the key to the Google Sheets API.
- Copy the key and paste it into the
apiKey
field of the INIT button.
Itch Key
- this key was provided on the Itch.io purchase page. Retrieve it via the purchase confirmation email. For issues, join our Discord server for assistance.Show Alerts
- choose whether to show yellow notifications for successful requests (only errors are shown if set to false).Configure
Google Sheets OPTIONS
commands. Select which Google Sheets commands to display in your command list to avoid clutter.
Default commands: Get Data, Append Data, Update Data, Batch Update, Find Data, Sort Range.
Use the Create Spreadsheet button to generate your first spreadsheet. The extension can only modify spreadsheets it created.
- After creating the spreadsheet, go to Google Sheets and manually make it public so the extension can read it.
- (Optional) Return to the INIT Settings button and set the
spreadsheetID
if you plan to use a single spreadsheet. The ID can be found in the URL:https://docs.google.com/spreadsheets/d/YOURSPREADSHEETID/edit?usp=sharing
.
Setup is now complete, and you can start using the extension!
General Parameters
Many buttons share the same parameters, so they will be omitted in the Buttons section.
SpreadsheetID
You can either enter it manually for each button or set the spreadsheetID
variable in your INIT button if you're using a single Spreadsheet.
The Spreadsheet ID can be found by going to your spreadsheet in the browser and copying it from the URL: https://docs.google.com/spreadsheets/d/YOURSPREADSHEETID/edit?usp=sharing
.
SheetName
Name of the specific Sheet you want to Get or Edit data in.
The extension automatically converts the sheet name to a sheet ID. If you rename a sheet to a previously used name (e.g., Sheet1 to Sheet2 and vice versa), you must fully close and reopen Bridge to reset your session. Otherwise, the old sheet ID will still be used.
Range
The data range you wish to Get or Edit, such as A1:B10
.
Dimension
The major dimension to Get or Edit data in.
For example, if you're using the Get Data command with the range A1:B10
and the dimension set to ROWS, it will return 10 arrays, each containing one row (e.g., A1-B1
, A2-B2
, etc.).
If the dimension is set to COLUMNS, it will return 2 arrays, each containing 1 column (e.g., A1-A10
, B1-B10
).
Values
(Applies to Append Data, Update Data, and Batch Update commands)
You can send values to the extension in two ways:
- A string of values separated by
|
, representing individual cells. For example, if you want to insert values in the A1:A7 range (with the dimension set to COLUMNS), you can format them like this:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday
. - A stringified array, where values will be inserted into the selected range starting from the first position.
- Create an array with some entries.
- Use the Stringify Array command.
- Insert the stringified array variable in the Values field.
Buttons
Append by Value/Array
Appends values to a spreadsheet using either a single variable or an array. The values must be arranged in either a single column or a single row.
Input box | Description |
---|---|
inputType | Specifies how the data should be interpreted. The default is User Entered. |
insertType | Determines how the input data should be inserted. |
Update Data
Functions similarly to the Append Data command, but instead of adding new data, it updates (overwrites) data in the specified range.
Batch Update
Use the Batch Update command to perform multiple update data requests in one batch. Instead of sending each request separately, Batch Update groups them together to reduce API calls.
Remember, the write request quota is shared with other users of the extension, so it's best to group as many Update Data
requests as possible.
Input box | Description |
---|---|
Amount | The number of Update Data requests you're sending. |
- Use the 'Google Sheets Batch Update' command and specify the number of requests.
- Send your Update Data requests as usual.
- The extension will queue all the requests and send them together once the last request is received. If you don't send all requests within 10 seconds, the queue is cleared and reset. Simply put, either all requests are sent at once, or none are sent.
Get Data
Retrieves data based on the specified range and dimension, and stores the results in an object.
The returned data is stored as an object with numeric keys (1, 2, 3, etc.), not as an array.
Input box | Description |
---|---|
Render | Determines how values are represented in the output. The default is formatted value. |
Delete Empty | Specifies whether to remove empty values before adding them to the stack. |
saveVariable | The name of the object in which the retrieved data will be saved. |
Find Data
Searches for a string/value in a single column or row and returns its coordinates along with related values. The search must be an exact match and only finds the first occurrence.
This command relies on a custom formula and works only if Google Sheets is set to English or if English is added as an additional language. See Using formulas in different languages for more details.
Input box | Description |
---|---|
Range | The range to search within, must be a single column or row, e.g., A1:A10 or A1:K1 . |
Find | The string to match, must exactly match the cell contents (case sensitive). For dates, use the format: DATE(YYYY,MM,DD) (e.g., DATE(2012,1,1) ), see the MATCH function. If searching for a number, ensure it's formatted as a string. |
Dimension | Select whether the search range is in COLUMNS or ROWS. |
Span | The number of rows/columns to return. Set to 0 for the whole column/row, or specify a range like 1:5 to retrieve rows 1-5 if searching by column, or columns A-E if searching by row. |
saveVariable | The variable to store the cell's coordinates. The returned object contains a "cell" key with the coordinates and a "values" key with the values in the specified dimension and range. If no match is found, an empty string "" is returned. |
Create Spreadsheet
Creates a new spreadsheet. The extension can only modify spreadsheets created specifically with this command.
Input box | Description |
---|---|
Title | The name for your new spreadsheet. |
saveVariable | The variable to store the newly created spreadsheet ID. |
You must manually make the newly created spreadsheet public.
Each created spreadsheet will have a hidden sheet added, which serves as a lookup for the Find Data command. Do not delete or rename this sheet.
Duplicate Sheet
Duplicates an existing sheet within the spreadsheet.
Input box | Description |
---|---|
SourceSheetName | The name of the sheet you want to duplicate. |
newSheetName | The name for the duplicated sheet. |
insertSheetIndex | The position in the spreadsheet where the duplicated sheet should be inserted. |
Add Sheet
Adds a new sheet to the selected spreadsheet.
Input box | Description |
---|---|
Name | The name of your new sheet. |
Index | The position where the new sheet should be inserted in the spreadsheet. |
Hidden | Whether or not to hide the new sheet. |
Copy Paste
Copies data from a source range and pastes it into a specified target range.
Input box | Description |
---|---|
Range | The source range to copy. |
TargetSheet | The name of the sheet to paste the data into. |
TargetRange | The range to paste the data into. |
PasteType | Specifies what kind of data to paste. |
PasteOrientation | Determines how the pasted data should be oriented. Setting to Transpose swaps rows and columns. |
Auto Fill
Automatically fills in additional data based on the existing data in the specified range.
Input box | Description |
---|---|
Range | The range to autofill. |
useAlternateSeries | Whether to generate data with the "alternate" series. This varies depending on the type and amount of data. |
Find Replace
Finds and replaces data within the specified range.
Input box | Description |
---|---|
Range | The range to search and replace values in. |
Find | The value to search for (string). To use regex, prefix the expression with regex . For example: regex o.* (.*) , replace with $1 Hello . Must follow Java regex rules. |
Replace | The value to use as a replacement. |
matchCase | Set to true if the search should be case sensitive. |
matchEntireCell | Set to true if the find value should match the entire cell. |
Split Text
Splits the text in a single column into multiple columns based on a specified delimiter.
Input box | Description |
---|---|
Range | The source data range. It must span exactly one column. |
Delimiter | The delimiter used to split the text. For example, :> or ,> . |
Sort Range
Sorts rows of data based on the sort order for a specific column.
Input box | Description |
---|---|
Range | The range of data to sort. |
sortOrder | The order in which the data should be sorted. |
dimIndex | The dimension index the sort should apply to, such as B or 1 (B is equivalent to 1). |
Randomize
Randomizes the order of the rows in the selected range.
Input box | Description |
---|---|
Range | The range of rows to randomize. |
Merge Cells
Merges a range of cells either by row or column.
Input box | Description |
---|---|
Range | The range of cells to merge. |
mergeType | Specifies how the cells should be merged. MERGE_ALL creates a single merge from the range, MERGE_COLUMNS merges each column, and MERGE_ROWS merges each row. |
Unmerge Cells
Unmerges cells that were previously merged.
Input box | Description |
---|---|
Range | The range within which all cells will be unmerged. If the range spans multiple merged areas, all will be unmerged. The range must not partially span any merge. |
Clear Data
Clears all data in the selected range.
Input box | Description |
---|---|
Range | The range to clear data from. Example: A1:A10 . |
Insert Range
Inserts new cells into a specified range, shifting existing cells either down or to the right.
Input box | Description |
---|---|
Range | The range where new cells will be inserted. |
Shift | Specifies |
the dimension to shift. ROWS
shifts cells down, and COLUMNS
shifts cells to the right. |
Delete Range
Deletes a range of cells.
Input box | Description |
---|---|
Range | The range of cells to delete. |
Shift | Specifies the direction to shift existing cells after deletion. ROWS shifts cells upward, and COLUMNS shifts cells to the left. |
Delete Duplicates
Removes rows in the specified range that contain duplicate values in the specified columns. This includes duplicates with variations in letter case, formatting, or formulas.
Input box | Description |
---|---|
Range | The range from which duplicate rows will be removed. |
Dimension | The dimension to analyze for duplicate values. |
StartIndex | The starting column (inclusive) of the range to check for duplicates. |
EndIndex | The ending column (exclusive) of the range to check for duplicates. |
Privacy
This extension uses a custom AWS secure API to retrieve your refresh token, as this is only possible server-side and cannot be done from your Bridge. It never stores or shares any of your credentials and can only ever access public spreadsheets created with it.
Get Help
Please see Troubleshooting for common extensions issues.