How to Duplicate Slide X Times | Google Slides Automations
Learn how to automate the duplication of slides in Google Slides using a simple script, allowing you to duplicate a slide a specific number of times with ease.
I'm going to show you an automation of duplicating the slide x times we have this more titles selection and we can copy and paste this absolutely but we can also command D and duplicate that but if we want to duplicate it a very specific number of times that's going to be just slightly difficult but we have this automation that we can duplicate slide and it's going to ask us how many times do we want to duplicate it if we want 10 let's hit okay and it's going to duplicate it exactly 10 times this is very useful for creating multiple headlines slides any kind of like duplication that you want to do very specific number I'm going to show you how to do this and how simple it can be to create more automations from a very Different Kinds of Automation How to Automate Spreadsheets
simple script we're going to go to extensions app script it will open something like this now I've already written this for you and we already have an on open function this is just getting the UI creating the menu That's up here next to help that's all that part is doing second part our function duplicate slide x times we are getting the current slide we're checking how many slides are in this selection with just dot length adding at the end here and if that count is more than one we're just going to say hey you need to select only one slide if nothing's selected we tell the user please select the slide if we have only one slide selected we'll ask how many times to duplicate the slide it's a little bit of a UI here here just slides Add-on menu on open Custom Menu - 1 Function Random Number Between 1 and 100
app.get ui. prompt and then asking how many times do you want to duplicate it and then once we get that response we're using that number as a for Loop to say this is how many times to duplicate it so really this slide. duplicate is the base code to say we duplicate it so I'm going to show you how to use this in another automation that we're going to write we're going to add another menu here add item duplicate slide 10 times so we can just type in exactly 10 times duplicate it in one click we can duplicate it 10 times instead of having to do the uh command D or copy paste 10 times and we're going to call this duplicate 10 times function duplicate 10 times we need those parentheses there Automate Move Blank Rows How to Automate Spreadsheets
and curly brackets to actually execute this function we're going to do cons slide equals slides app get active presentation get selection get current page as slide and then we're going to do slide that's that const here this variable duplicate make sure you have this parentheses at the end this will duplicate it one time so we just literally copy and paste this 10 times one two 3 four five 6 7 8 9 10 this alone just doing this 10 times will duplicate the slide 10 times so let's save this and to add this to our menu we will need to reopen open the sheet or refresh it we could or close it and open Automatically Clear Content | Refresh Reuse Recycle Templates Duplicate Tab On Click of an Image Make a Button
it again it'll have this automations menu and there it is duplicate slide 10 times so let's delete these and select one and duplicate 10 times and there it is done and done so we can go back to our execution app scripts we can create more of these let's say we want to duplicate it two times or three times or 100 times we can do that but this lines of code are going to be exactly the number of times we duplicate let's do a little for Loop to do 100 times so we don't have to uh copy paste this code 100 times function duplicate 100 times we're going to add it first to our automation menu and make sure we have Different Kinds of Automation How to Automate Spreadsheets
the exact function name here the first part is what the user sees and the second part is what the function name is to actually execute it so we're going to get our existing slide and then 4 I = 1 semicolon I is less than 100 which I think this will be 99 times so I do zero and then I plus plus so we're going to do zero add it all the way up to 99 and then once it's 100 it will stop slide. duplicate we'll save that and now this single line of code slide. duplicate is going to be running a 100 times we can change this to let's say I I equal 1 and I is less than or equal to 100 so that once it runs 101 times it will stop it Spreadsheet Automation 101 Lesson 2: For Loop
won't do the 100 and first time and let's see this code let's delete everything except the very first we have to make sure we close and reopen to get that other option in our slides automation so let's refresh it see that automations menu come up duplicate 100 times it'll run fairly quickly does 100 duplications perfect that's the automation to duplicate your slide x times we have shown you how to get a prompt and how to actually execute this any specific number of times if you want this exact code check out better sheets. csid you can get this code exactly copy Automatically Clear Content | Refresh Reuse Recycle Templates Run 100 ChatGPTs at One Time Random Number Between 1 and 100
and paste it for free along with a number of other slide automations over at better sheets. c/s slides and make sure you subscribe here on YouTube to better sheets to get more out of your Google Sheets and now Google Slides One Weird Google Sheet Formula for Bulk Publishing With AI Extract URLs from Google Sheets Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets. Better Letters