'Make a copy button for a cell in google sheet

I'm stuck with a problem on google sheet, I know the solution is apps script but I have limited knowledge in this area, I would like to create a button that copy a cell, that's all, someone can help me?



Solution 1:[1]

Get Current Cell Value

function copyCurrentCell() {
  return SpreadsheetApp.getActive().getCurrentCell().getValue();
}

function launchSidebar() {
  let ui = HtmlService.createHtmlOutput(`<input type="text" id="txt1" /><br /><input type="button" value="Get Current Cell Value" onClick="google.script.run.withSuccessHandler( (v) => {document.getElementById(\'${"txt1"}\').value = v;}).copyCurrentCell();" />`);
  SpreadsheetApp.getUi().showSidebar(ui)
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cooper