I am trying to make a simple button using google sheets and the google scripts functionality that copys a predetermined prompt to the clipboard for easy and repetative copying on a tablet. Since copying and pasting on a tablet is a pain especially when editing the same block text, I am looking to do this via a button.
I thought that I would be able to accomplish this via the script editor with the following script as per the suggestions found in a similar post here and here:
function FirstPrompt() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = ss.getDataRange().getValues()[0];
var name = data[1];
var pks = data[3];
var textblock = `${name} did well today while he worked on ${pks}. We look forward to working with ${name} again soon!`
navigator.clipboard.writeText(textblock)
.then(() => {
Logger.log("Text copied to clipboard...")
})
.catch(err => {
Logger.log('Something went wrong', err);
})
}
But I am getting this an an error.
ReferenceError: navigator is not defined
I have attached the script to a button hoping that that would count as the user defined input. Any help with this would be greatly appreciated.