Search this site
Embedded Files
bit.ly/harneytech25
  • 2025 Conference
    • Session Schedule
    • Abbey Askew Sessions
    • Michael Morris Sessions
    • Tim Welch Sessions 2025
      • 2025 Session 1
      • 2025 Session 2
      • 2025 Session 3
      • 2025 Session 4
  • Padlet Practice
  • 2024 Conference
    • Eric Curts Sessions
    • Abbey Askew Sessions
    • Tim Welch Sessions
      • Session 1: Using Apps Script
      • Google Sheets
      • GMail Layouts
    • Shark Tank
  • 2023 Conference
    • Tim Welch Sessions
      • Intro To Apps Script
      • Exit Tickets
      • Google Sheets Shortcuts
      • Intro To Canva
      • Animal Bingo and Math Facts
      • Audience Response
    • Abbey Askew Sessions
    • Zach Knapp Sessions
    • Session Schedule
bit.ly/harneytech25
  • 2025 Conference
    • Session Schedule
    • Abbey Askew Sessions
    • Michael Morris Sessions
    • Tim Welch Sessions 2025
      • 2025 Session 1
      • 2025 Session 2
      • 2025 Session 3
      • 2025 Session 4
  • Padlet Practice
  • 2024 Conference
    • Eric Curts Sessions
    • Abbey Askew Sessions
    • Tim Welch Sessions
      • Session 1: Using Apps Script
      • Google Sheets
      • GMail Layouts
    • Shark Tank
  • 2023 Conference
    • Tim Welch Sessions
      • Intro To Apps Script
      • Exit Tickets
      • Google Sheets Shortcuts
      • Intro To Canva
      • Animal Bingo and Math Facts
      • Audience Response
    • Abbey Askew Sessions
    • Zach Knapp Sessions
    • Session Schedule
  • More
    • 2025 Conference
      • Session Schedule
      • Abbey Askew Sessions
      • Michael Morris Sessions
      • Tim Welch Sessions 2025
        • 2025 Session 1
        • 2025 Session 2
        • 2025 Session 3
        • 2025 Session 4
    • Padlet Practice
    • 2024 Conference
      • Eric Curts Sessions
      • Abbey Askew Sessions
      • Tim Welch Sessions
        • Session 1: Using Apps Script
        • Google Sheets
        • GMail Layouts
      • Shark Tank
    • 2023 Conference
      • Tim Welch Sessions
        • Intro To Apps Script
        • Exit Tickets
        • Google Sheets Shortcuts
        • Intro To Canva
        • Animal Bingo and Math Facts
        • Audience Response
      • Abbey Askew Sessions
      • Zach Knapp Sessions
      • Session Schedule

Intro To Apps Script

YouTube Channel GSuite Pros Redtailfan School


Sessions

Apps Scripts

Exit Tickets

Sheets Shortcuts

Canva

Gamification

Apps Script can help you do some amazing things. As teachers, time is super precious, and finding ways to save your time and automate tasks can be super useful. We will dip our toes in the world of apps script in this session, starting with how to build macros to automate simple tasks.

Five lines of code to add a note to a cell on edit

This set of code will add a note to a cell showing the date of the change and the old text before the change!

function onEdit(e) {

  const { range, oldValue } = e;

  const note = `Cell edited on ${new Date()}. Previous value: ${oldValue}`;

  range.setNote(note);

}

  1. Highlight and copy the code above

  2. Open a new google spreadsheet

  3. Go to Extensions/Apps script

  4. Highlight the text in the code editor

  5. Paste the code you copied to the clipboard

  6. Save and name the project

  7. Go to your sheet and edit a cell

  8. What happens?

Add a Script to a Form to be able to collect responses to a Presentation

Audience Response Script

This script (attached to the form) will allow you to have students fill out a form, and when they submit the form, a new slide with their response will be added to the slide presentation.

  1. Create a Form with two items, Name and Response

  2. Create your presentation

  3. Add one slide that has a Text box titled "Name" and one titled "Response" Format and organize them however you want. I also hide this slide from showing.

  4. On the form, open the script editor (under the 3 dots to the right of Send)

  5. Paste in this script and be sure to put in your Presentation ID and the slide template ID you are using for the responses.

  6. Save and name the script

  7. You will have to add a trigger to this script and set it to execute on form submit.

  8. Distribute the form with a QR code or however you like.

  9. Collect the audience responses to the slide presentation.

ID's

function audienceResponse(e) {


 const openPresentation = SlidesApp.openById('place your slide presentation ID here');

 const audienceSlide = openPresentation.getSlideById('place your slide ID here')

 const newSlide = audienceSlide.duplicate();

 const newSlideId = newSlide.getObjectId();

 var items = e.response.getItemResponses();

 const changeSlide = openPresentation.getSlideById(newSlideId);

 changeSlide.replaceAllText('Name', items[0].getResponse());

 changeSlide.replaceAllText('Answer', items[1].getResponse());

 }

Add a Trigger to the script

Manually written Script to copy Sheet1 to Sheet2

function sheet1ToSheet2(){

 const ss = SpreadsheetApp.getActiveSpreadsheet();

 const source = ss.getSheetByName('Sheet1').getRange('A1:J20').getValues();

 //console.log(source);

 const destination = ss.getSheetByName('Sheet2');

 const date = new(Date);

 destination.getRange(destination.getLastRow()+1,1,1,1).setValue(date);

 destination.getRange(destination.getLastRow()+1,1,20,10).setValues(source);

}

ChatGPT Generated Response

I asked ChatGPT this question:

I need a google apps script to copy the data on Sheet1 to Sheet2 and i need it to have a Utility menu in order to run.

And I got this response 

function onOpen() {

  var ui = SpreadsheetApp.getUi();

  ui.createMenu('Utility')

      .addItem('Copy Sheet1 to Sheet2', 'copySheet1ToSheet2')

      .addToUi();

}


function copySheet1ToSheet2() {

  var sheet1 = SpreadsheetApp.getActive().getSheetByName('Sheet1');

  var sheet2 = SpreadsheetApp.getActive().getSheetByName('Sheet2');

  var data = sheet1.getDataRange().getValues();

  sheet2.clearContents();

  sheet2.getRange(1, 1, data.length, data[0].length).setValues(data);

}

Followed by these instructions:

To use this script, follow these steps:

  1. Open your Google Sheets document.

  2. Click on the "Tools" menu at the top of the screen.

  3. Select "Script editor" from the dropdown menu.

  4. Copy and paste the above code into the script editor.

  5. Save the script.

  6. Go back to your Google Sheets document.

  7. Refresh the page (or close and reopen the document).

  8. You should now see a "Utility" menu at the top of the screen.

  9. Click on "Utility" and select "Copy Sheet1 to Sheet2" to run the script.

Note: Make sure that you have both a Sheet1 and Sheet2 in your document with the data you want to copy. Also, the script will clear the contents of Sheet2 before copying the data from Sheet1. If you want to keep any existing data in Sheet2, you'll need to modify the script to append the data instead of overwriting it.


Report abuse
Report abuse