-1

The link within the button is a link to a linked Google Form. I know how to draw a button, but do not know how to write and assign the script to the button / image.

The link I need the button to execute is: https://docs.google.com/forms/d/e/1FAIpQLSdupUHV2uO6q69BHXvPzE1DgJu32HYQ31zPdyZ5uflmOftXRw/viewform

All help would be much appreciated

Dave
  • 7
  • 2
  • 2
  • Possible duplicate of [Adding Buttons To Google Sheets and Set value to Cells on clicking](https://stackoverflow.com/questions/28668766/adding-buttons-to-google-sheets-and-set-value-to-cells-on-clicking) – Rubén Aug 08 '18 at 22:32

1 Answers1

0

Follow these steps:

1) On the Script Editor (Tools > Script Editor) add this function (I already added your form URL):

function openForm(){

  var html = "<script> window.open('https://docs.google.com/forms/d/e/1FAIpQLSdupUHV2uO6q69BHXvPzE1DgJu32HYQ31zPdyZ5uflmOftXRw/viewform');</script>";
  var ui = HtmlService.createHtmlOutput(html)
  SpreadsheetApp.getUi().showModelessDialog(ui,"demo");

}
  1. Save your script (Ctrl + S).
  2. Back to your Sheet, click on your button > click on the three dots > Assign cript... > Enter openForm

Voilà! When you click on the button the Form will be opened in a new tab. Just note you might need to allow pop-ups.