Creating effective speaker notes for presentations can be a time-consuming task, especially when dealing with multiple slides. But what if you could automate the process?
In this tutorial, we’ll walk through how to build an automation script using Google Apps Script and Gemini 2.0 Flash Model to generate clear and concise speaker notes for Google Slides.
What You’ll Learn
- How to extract content from Google Slides using Google Apps Script
- How to send slide content to Gemini AI for note generation
- How to insert AI-generated notes directly into the slide speaker notes section
Step 1: Setting Up Google Apps Script
To get started, open your Google Slides presentation and navigate to:
- Click on Extensions > Apps Script.
- This will open the Google Apps Script editor where we can write our code.
Step 2: Get Your Gemini API Key
We need an API key to access the Gemini 2.0 Flash model. Follow these steps:
- Go to Google AI Studio.
- Navigate to the Get API Key section.
- Copy your API key.
Step 3: Writing the Apps Script Code
Now, let’s write the script to extract text from slides and send it to Gemini for AI-generated speaker notes.
function generateSpeakerNotes() { var presentation = SlidesApp.getActivePresentation(); var slides = presentation.getSlides(); var geminiAPIKey = "YOUR_GEMINI_API_KEY"; var geminiEndpoint = "https://api.gemini.google.com/v1/models/gemini-2.0-flash:generate"; slides.forEach((slide, index) => { var content = ""; var shapes = slide.getShapes(); shapes.forEach(shape => { if (shape.getText()) { content += shape.getText().asString() + "\n"; } }); var prompt = "Create concise speaker notes for the following slide content: \n" + content; var response = UrlFetchApp.fetch(geminiEndpoint, { method: "post", contentType: "application/json", headers: { "Authorization": "Bearer " + geminiAPIKey }, payload: JSON.stringify({ prompt: prompt }) }); var output = JSON.parse(response.getContentText()).choices[0].text; var notesPage = slide.getNotesPage(); var noteShape = notesPage.getShapes()[0]; noteShape.getText().setText(output); Logger.log("Notes added to slide " + (index + 1)); }); Logger.log("Speaker notes generation complete."); }
Step 4: Running the Script
Once the script is added, follow these steps to execute it:
- Click the Run button in the Apps Script editor.
- Authorize the script when prompted.
- The script will process all slides and insert speaker notes.
Conclusion
With this automation, you can quickly generate high-quality speaker notes for your Google Slides presentations, saving time and effort.
Try experimenting with different prompts to refine the style of notes generated.
If you found this tutorial helpful, consider subscribing for more automation guides!