Links to a script in Google Sites

To link a script to a Google Site, you need to follow the following steps:

  1. Open your Google Site and navigate to the page where you want to add the link to your script.
  2. Click on the “Insert” button in the top menu, then select “Link”.
  3. In the link dialog box, select “Apps Script” from the “Link Type” dropdown menu.
  4. Select your script from the list of available scripts.
  5. Choose the function you want to link to.
  6. Click “OK” to insert the link to your script.

Here’s an example of how to create a new file in Google Sheets using a script linked to a Google Site:

function createNewSheet() {
  var ss = SpreadsheetApp.create("New Sheet");
  var sheet = ss.getActiveSheet();
  sheet.getRange("A1").setValue("Hello World!");

Once you’ve linked this script to your Google Site, you can create a link to the createNewSheet function, and users can click on it to create a new sheet with the text “Hello World!” in cell A1.