I believe your goal as follows.
- For Google Spreadsheet, you want to put an image button into a cell, and want to jump to other cell on other sheet in the same Spreadsheet when the button is clicked.
Issue and workaround:
In the current stage, unfortunately, the image put in a cell cannot be assigned by a function. So in this case, as a workaround, I would like to propose to use the OnSelectionChange trigger of the simple trigger.
Usage:
In order to use this workaround, please do the following flow.
1. Put image to a cell.
Please put an image to a cell. In this case, as a sample, please put an image into a cell "A1" of "Sheet1".
2. Sample script.
Please copy and paste the following script to the script editor of Spreadsheet.
function onSelectionChange(e) {
const range = e.range;
if (range.getSheet().getSheetName() != "Sheet1" || range.getA1Notation() != "A1") return;
const jumpTo = "Sheet2!A1";
e.source.getRange(jumpTo).activate();
}
3. Testing.
In this sample script, when the cell "A1" of "Sheet1" is clicked, the function of onSelectionChange
is automatically run by firing the trigger, and the cell of "A1" in "Sheet2" is activated.
Note:
- This is a simple sample script for testing this workaround. So please modify this for your actual situation.
Reference: