Creating Google Slides with Apps Script: Adding Text and Charts

Published: 01 March 2023
on channel: Laurence Svekis
7,536
44

This function creates a new Google Slides presentation with the given title (Laurence Svekis) using the SlidesApp.create() method. It then retrieves the first slide in the presentation using slides.getSlides()[0], which is the slide that was automatically created when the presentation was created. It inserts a text box with the same title as the presentation using slide.insertTextBox(title), and duplicates the slide using slide.duplicate() to create a second slide with the same content as the first slide.
This function retrieves a Google Slides presentation using SlidesApp.openById(id), where id is the ID of the presentation. It then retrieves the first slide in the presentation using slides.getSlides()[0]. It also retrieves a Google Sheets spreadsheet using SpreadsheetApp.openById(sid), where sid is the ID of the spreadsheet, and gets the sheet with the name data using getSheetByName('data'). It then retrieves the first chart in the sheet using sheet.getCharts()[0].

The function logs the chart object using Logger.log(chart). Finally, it inserts the chart as an image on the first slide using slide1.insertSheetsChartAsImage(chart). This method creates an image of the chart and inserts it into the slide as a shape.

Overall, these two functions demonstrate how to create and manipulate Google Slides presentations using Google Apps Script. The first function creates a new presentation and adds content to it, while the second function retrieves an existing presentation and inserts a chart from a Google Sheets spreadsheet onto a slide.

Course content web development and web design courses with coding examples and source code for the lesson content. Source Code is available within my Github account. Lessons posted are designed to help students learn more about a specific topic related to modern web development and applying code.
Laurence Svekis is a professional top selling course author having instructed over 1 Million students both online and in person. Laurence Svekis is a Google Developer Expert specializing in Google Workspace automation using Google Apps Script Code.

Check out my Website for more details at https://basescripts.com/
Subscribe    / @laurencesvekiscourses  

Tags and Keywords

#GoogleAppsScript #GoogleSlides #GoogleSheets #Charts #Spreadsheets #Automation #Programming #JavaScript #SlidesPresentations #DataVisualization #DataAnalysis #Embedding #Image #DuplicateSlide #InsertSlide #UpdateSlide #AddSlide #SpreadsheetID #SheetName #ChartObject #Logger #Array #Object #Permissions #WebURL #SlideID #Table #Text #TextBox #SlideObject #Presentation #Title #Function #Code #RunCode #GoogleDrive #GoogleServices #GoogleAPI #OnlineTools #Collaboration #CloudComputing #G Suite #Workspace #GoogleCloudPlatform #GCP #APIs #Developers #AppScript #OnlineLearning #Tutorials #CodeSnippets #CodeExamples #Coding #TechSkills #DigitalProductivity #RemoteWork #WorkFromHome #Business #Entrepreneurship #Education #Technology #Innovation #FutureOfWork #InternetOfThings #AI #MachineLearning #BigData #CloudStorage #Productivity #Efficiency #Workflow #OrganizationalTools #CollaborationTools #Teamwork #OnlineCollaboration #VirtualTeam #ProjectManagement #RemoteTeam #Communication #OnlineCommunication #OnlineCollaborationTools #OnlineProductivity #RemoteProductivity #CloudComputingTools #OnlineAutomation #OnlineProgramming #OnlineDevelopment #OnlineLearningResources #OnlineEducation #OnlineTechSkills #DigitalSkills #DigitalLiteracy #GoogleWorkspace #GoogleCloud #GoogleDevelopers #GoogleAPIs #GoogleServicesAPIs #GoogleSlidesAPI #GoogleSheetsAPI #GoogleDriveAPI #GoogleAppsScriptAPI


Watch video Creating Google Slides with Apps Script: Adding Text and Charts online, duration hours minute second in high quality that is uploaded to the channel Laurence Svekis 01 March 2023. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 7,536 times and liked it 44 visitors.