Script: Creating a Slides file

Creates a Google Slides file from script code.  Recall it was one of those board game Sundays during which this was attempted and it was Praveen Sridhar who helped me out with this piece of code.  

This is a fun script. Tried out more as a test. Wish to attempt capturing a deck of one of my talks in this format as a script. Again, more as a fun thing to do at this point.  


Script

var NAME = "Read Me";

var deck = SlidesApp.create(NAME);


function addText() {

  

  var slide;

  var shapes;

  var textRange;

  

  slide = deck.getSlides()[0]

  

  shapes =  slide.getShapes();

  textRange = shapes[0].getText();

  textRange.setText('Mail works best');

  textRange = shapes[1].getText();

  textRange.setText('skg@sijokuruvilla.in');

  

  slide = deck.appendSlide(SlidesApp.PredefinedLayout.SECTION_HEADER);

  shapes =  slide.getShapes();

  textRange = shapes[0].getText();

  textRange.setText('Email: skg@sijokuruvilla.in');

  

  slide = deck.appendSlide(SlidesApp.PredefinedLayout.SECTION_HEADER);

  shapes = slide.getShapes();

  textRange = shapes[0].getText();

  textRange.setText('Twitter: @sijokuruvilla');

  

  Logger.log(textRange.asString())

}


Notes

  • Slides file that was created - Link
  • Reference screenshots provided below
  • Screenshots