This is a sample script for highlighting the row and column of the selected cell using Google Apps Script. For this, the OnSelectionChange event trigger is used.
Please copy and paste the following script to the script editor of Spreadsheet. And, please select a cell. By this, the script is run by the OnSelectionChange event trigger.
function onSelectionChange(e) {
const range = e.range;
const sheet = range.getSheet();
const maxRows = sheet.getMaxRows();
const maxColumns = sheet.getMaxColumns();
sheet.getRange(1, 1, maxRows, maxColumns).setBackground(null);
sheet.getRange(1, range.getColumn(), maxRows, 1).setBackground("yellow");
sheet.getRange(range.getRow(), 1, 1, maxColumns).setBackground("yellow");
}
@kenomd Thank you for your comment. I have to apologize for my poor English skill. Unfortunately, from
Help, I copied and pasted the code, and set triggers but code doesn't work.
, I cannot understand your current situation. Because when I tested my sample script, unfortunately, I can confirm that the script works fine. This is due to my poor skill. I deeply apologize for this. In order to correctly understand your issue, can you provide the detailed flow for correctly replicating your issue? By this, I would like to confirm it. If you can cooperate to resolve your issue, I'm glad. Can you cooperate to do it? By the way, also I cannot understandset triggers
in your comment.