I need some help from the experts here.
Please take a look at this spreadsheet:
Here is the story (in short):
I work with many comments, and I need to respond to them. Because there are many of them I need to have quick access to my pre saved answers. So I have a spreadsheet, and my answers are written as comments to cells, and the cells itself just show me category (for easier search)
So I need when I make single mouse click on the cell it copies automatically the comment from the selected cell to the clipboard. Is there any way to make it using Apps Script?
Because I'm not a developer and can't write the code by myself I asked chatGPT to write the script for me.
The result didn't work for me. It's just doesn't work
function onSelectionChange(e) {
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getActiveCell();
var comment = cell.getComment();
if(comment != "") {
var clipboard = Utilities.getClipboard();
clipboard.setContent(comment);
SpreadsheetApp.getActive().toast('Comment copied to clipboard');
}
}
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var entries = [{
name : "onSelectionChange",
trigger : "onSelectionChange"
}];
ScriptApp.newTrigger("onSelectionChange").forSpreadsheet(spreadsheet).onSelectionChange().create();
}
When I run this script inside Apps Script it show that everything works, but there is no change inside the spreadsheet itself.