Merging slide templates with tabular data


This has been superseded by the add-on version - SlidesMerge add-on, but the below should still works too if you prefer to bake your own simplified version.

This isn't an add-on yet (although I may get round to making it into one). For now the script has a few parameters you can set up before running it. The purpose is a kind of Mail Merge for Slides. Working with slides is a little more complex than with mail, largely because a slide deck contains multiple slides, so presents many more options. 

What can you do

Slide merge


Example


Here's a template deck. It contains a master slide (not to be duplicated), and some other slides that are repeated for each row in the input data.

Template deck


And here's the result after merging

actors-results-demo


Here's the data that was used.

slide merge test data


Options


In this example, I used these options
function localTest() {
  return {
    template: "1Q6K57zLdnL6Vm0gzKuukOLs0npA5BeBw2kO7xEb5Z9E", // the slide template id
    sheetId: "1t8IFpVvsas2uOiuT8g21qoeB4qf8IIZDLuC85OVVH1k", // the sheet id
    sheetName: "Actors", // the name of the sheet with the variable data
    presoFolder: "/Published Scripts/slidemerge/results", // the folder to write the output preso(s) to
    presoName: "actors-results", // the base name for the preso(s) created
    options: {
      type: "single",    // multiple , single
      suffixHeading: "", // used with multiple, to append to deck name, gets data from sheet row variable
      startRow: 1,       // where to start
      finishRow: 3,       // where to finish
      masters:[1]        // an array of slide positions (starting at 1 to not duplicate)
    },
    static: {
      demoTitle: "slidemerge demo - www.mcpher.com", // any variables here can be substituted in the body of the template
      appVersion: "alpha v0.1",
      appIcon: "https://storage.googleapis.com/effex-console-static/bundle/src/img/exn64.png"
    }
  };
}

  • Template - the slides template
  • sheetId - the id of the sheet containing the data
  • sheetName - the name of the sheet containing the data
  • presoFolder - the Drive folder to write the merged slides to
  • presoName - the name (or the base for the name) of the created slides
  • options
    • type  - can be single (1 deck is created containing all the slides for all rows in the data) or multiple (a deck is created for each row in the data)
    • suffixHeading - the name of a column in the data to take the name to append to the presoName when working with type=multiple. This will create presentation files where their names are derived from the data. If blank, and multiple is selected, the row number will be used. Ignore for type=single
    • startRow - if specified, where to start from in the data - first row is 1. If not specified it will start at 1.
    • finishRow - if specified, where to finish in the data - first row is 1. If not specified, it will go till the end.
    • masters - an optional field of slide numbers (starting at 1) , to be considered title slides, and not repeated for each row in the data
  • static - these are variables that can appear in the template and will be replaced with the values given on all slides.

Next steps


I'm looking for feedback before I convert this into an add-on. 

To use, take a copy of https://script.google.com/d/1nwWTZEXMKX78L3AUF-9jdS3b-JOger-r4gz72ziAsx1q4oldTH8llgoB/edit?usp=sharin, go to the script called ThisIsTheModYouAreLookingFor and play with the options. 





Why not join our community , follow the blogtwitterG+  and let me know.

Comments