Copy of Today

Slides Auto Date

5/20/2018 14:44:50

A client wanted a way to insert today's date automatically into his slides so his students could know today's date. Right now there is not a function in Slides to insert date, so I have documented here the work around to accomplish this.

It is done with a spreadsheet, using the =TODAY() formula in a cell, then copying the cell or multiple cells and then pasting the table (series of cells) using the 'link to spreadsheet' option. This will allow you to update the date on your slide each day by clicking the update button that appears on the pasted table in the slide.

Autodate
Date

How to create a menu in a Google Doc to be able to insert today's date at the cursor

//This creates the menu

function onOpen() {

var ui = DocumentApp.getUi();

// Or DocumentApp or FormApp.

ui.createMenu('Utilities')

.addItem('Insert Date', 'insertAtCursor')

.addToUi();

}

//Inserts the date at the current cursor location in boldface and italic.

function insertAtCursor() {

var cursor = DocumentApp.getActiveDocument().getCursor();

if (cursor) {

// Attempt to insert text at the cursor position. If insertion returns null,

// then the cursor's containing element doesn't allow text insertions.

var date = Utilities.formatDate(new Date(), "GMT", "MM-dd-yyyy"); // "yyyy-MM-dd'T'HH:mm:ss'Z'"

var element = cursor.insertText(date);

if (element) {

element.setBold(true);

element.setItalic(true);

} else {

DocumentApp.getUi().alert('Cannot insert text at this cursor location.');

}

} else {

DocumentApp.getUi().alert('Cannot find a cursor in the document.');

}

}


  1. Copy this script
  2. Open a google doc
  3. Go to Tools/Script Editor
  4. Higlight the text in the editor and delete it and then paste in this script
  5. Save and name the project
  6. Refresh the google doc
  7. A new menu appears called utilities
  8. On first run you need to authorize
  9. Today's date is inserted at the cursor
  10. This script has it set to bold and italic, you can change that in the script by changing the element.setBold(true) or element.setItalic(true) to (false).

This is an autodate doc example. You can also make a copy of this document, and it will contain the script.

autodate example

In the forums a question was asked on how to create a random name generator within a slide presentation. Here is an example of how to do that.

random (Responses)
Random Name Generator
Random Name Generator