SAMMI Stuff

Find all the information you need to set up Deck Hopper and my extensions for your SAMMI.

Random Bunny

SAMMI Extensions

Google Sheets

Get on Ko-fi
Slide 0

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

  1. Install the extension. You can follow the Extension Install Guide.

  2. 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:

      1. Go to the Google Cloud Console.
      2. Select or create a project for the API key.
      3. In the menu, choose APIs & Services.
      4. Enable the Google Sheets and Google Drive APIs.
      5. Create an API key under APIs & Services > Credentials.
      6. Optionally restrict the key to the Google Sheets API.
      7. 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.

  3. 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.
  4. 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:

  1. 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.
  2. A stringified array, where values will be inserted into the selected range starting from the first position.
    1. Create an array with some entries.
    2. Use the Stringify Array command.
    3. 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 boxDescription
inputTypeSpecifies how the data should be interpreted. The default is User Entered.
insertTypeDetermines 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 boxDescription
AmountThe number of Update Data requests you're sending.
  1. Use the 'Google Sheets Batch Update' command and specify the number of requests.
  2. Send your Update Data requests as usual.
  3. 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 boxDescription
RenderDetermines how values are represented in the output. The default is formatted value.
Delete EmptySpecifies whether to remove empty values before adding them to the stack.
saveVariableThe 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 boxDescription
RangeThe range to search within, must be a single column or row, e.g., A1:A10 or A1:K1.
FindThe 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.
DimensionSelect whether the search range is in COLUMNS or ROWS.
SpanThe 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.
saveVariableThe 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 boxDescription
TitleThe name for your new spreadsheet.
saveVariableThe 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 boxDescription
SourceSheetNameThe name of the sheet you want to duplicate.
newSheetNameThe name for the duplicated sheet.
insertSheetIndexThe position in the spreadsheet where the duplicated sheet should be inserted.

Add Sheet

Adds a new sheet to the selected spreadsheet.

Input boxDescription
NameThe name of your new sheet.
IndexThe position where the new sheet should be inserted in the spreadsheet.
HiddenWhether or not to hide the new sheet.

Copy Paste

Copies data from a source range and pastes it into a specified target range.

Input boxDescription
RangeThe source range to copy.
TargetSheetThe name of the sheet to paste the data into.
TargetRangeThe range to paste the data into.
PasteTypeSpecifies what kind of data to paste.
PasteOrientationDetermines 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 boxDescription
RangeThe range to autofill.
useAlternateSeriesWhether 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 boxDescription
RangeThe range to search and replace values in.
FindThe 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.
ReplaceThe value to use as a replacement.
matchCaseSet to true if the search should be case sensitive.
matchEntireCellSet 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 boxDescription
RangeThe source data range. It must span exactly one column.
DelimiterThe 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 boxDescription
RangeThe range of data to sort.
sortOrderThe order in which the data should be sorted.
dimIndexThe 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 boxDescription
RangeThe range of rows to randomize.

Merge Cells

Merges a range of cells either by row or column.

Input boxDescription
RangeThe range of cells to merge.
mergeTypeSpecifies 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 boxDescription
RangeThe 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 boxDescription
RangeThe 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 boxDescription
RangeThe range where new cells will be inserted.
ShiftSpecifies

the dimension to shift. ROWS shifts cells down, and COLUMNS shifts cells to the right. |


Delete Range

Deletes a range of cells.

Input boxDescription
RangeThe range of cells to delete.
ShiftSpecifies 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 boxDescription
RangeThe range from which duplicate rows will be removed.
DimensionThe dimension to analyze for duplicate values.
StartIndexThe starting column (inclusive) of the range to check for duplicates.
EndIndexThe 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.

Previous
Folder Files