I’m looking to write a script that will replace two images in Google Slides based on two image URLs saved in adjacent cells (ie B1,B2) in Google Sheets. The images are both on the same slide. I am unsure of how to loop through the images, while simultaneously looping through the Sheets cells (ie so image 1 is replaced based on the URL in cell B1, then image 2 is replaced based on the URL in cell B2). Any help on an example script (I am a newbie!!) would be greatly appreciated.
Google script: Replace 2 images in Slides based on URLs saved in Sheets
1k views Asked by Nigel21 At
1
There are 1 answers
Related Questions in GOOGLE-APPS-SCRIPT
- How to use custom font during html to pdf conversion?
- parameter values only being sent to certain columns in google sheet?
- AppScript to replace image in google slides
- Email Sent Using AppScript Appears in Sent Box, but does not appear in Recipient's Inbox
- Update a MySQL row depending on the ID in Google Sheets Apps Script
- Would like the script to return the PDF letter via email with the sheet name not the spreadsheet name
- App script to prevent duplicate form submission
- Redirect Users to another website using GAS
- How do I create a Line Graph on App Script?
- Error (Status of 500) and X-Frame-Options with google apps script redirect function
- How do I add the Luxon library google sheet script
- AppScript For Google Form
- google sheet script to convert the Scientific notation in the selected area to number
- onEdit() 'row is not defined' error using checkboxes
- Regex expression not working on Google Form
Related Questions in GOOGLE-SHEETS
- google sheets, search and replace for next colum
- AppScript to replace image in google slides
- Regex to match repeated substring in Google Sheets
- How to append row to specific columns with gspread?
- Find a value in a range of cells (multiple rows and columns)
- Create date column based on range
- Look up a value using month of the date
- Data recovery based on other data
- Gsheet - Automatically send an email using a date & time in a Cell
- google sheet script to convert the Scientific notation in the selected area to number
- How can I limit the number of dropdown entries in a column in Google Sheets
- Parse tag in html via Google Sheets (importxml)
- Why is the background color of my google sheet web app not being applied?
- Google Sheets script that automatically locks a sheet 24 hours after a cell is edited
- My Google Sheets formulas mysteriously break as time passes, fix themselves when refreshed
Related Questions in GOOGLE-SLIDES
- Embeded Google slides opens new tab on screen touch (mobile mode)
- Google slides API provide the wrong width and Height measurement value in Nodejs
- Problem interpreting how to copy / paste tables within a presentation using apps script
- Permissions Error: Unable to Send Email with PDF attachment via Google Apps Script Trigger on Form Submission
- How can I upload an image from google sheet to slides
- How to access shapes inside grouped shapes on Google slides using Apps Script?
- Google Script in Slide - How copy a list of email from a Slide Table to Gmail
- How to create sub bullet points (nested bullet points under bullet points) using Google Slides API
- Add hyperlink efficiently to text just replaced on Google Slides
- Google Slide image is okey but when downloaded as pdf and opened in Mac's preview software image is gone
- How to insert image into Google slides with [Exception: The image you are trying to use is invalid or corrupt.] error?
- How to get the speadsheet id of an embedded table in google slide with Google Apps Script?
- To make a copy of Google Slides template and update the values in the slides as per data sheet in Google Sheets
- I have a google app script, where it converts a google slide template to a pdf, am facing pdf conversion issue
- Format specific words in a Google Slide using App Script
Related Questions in IMAGE-REPLACEMENT
- How to add mask to image when replacing images in pdf with pdfbox
- How to replace image src based on screen size in Java Script
- Google script: Replace 2 images in Slides based on URLs saved in Sheets
- How to replace a masked part of an image with another image using openCV python?
- Using OpenCV and Python to replace a segmented part of an image with other images
- Replace background image with GIF once loaded
- Image processing with node
- Using a photo as <h1> in CSS
- setImageResource works intermittently
- Changing picture of tool button at runtime does not work anymore
- can i use Href on li b?
- Replace anonymous content but not child elements
- css image replacement: why the kellum method doesn't work with button elements?
- change text and image on click in slideshow
- Replace list item with image
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
This is sort of a mish mash of various things. I've been working on it for several hours and I've finally been able to replace several images on a Slide Presentation. But it's not a refined solution by any means.
First function throws up a prompt dialog to get you to enter a Slide Presentation Id. It then goes through all of the slides and all of the page elements looking for page elements of type SlidesApp.PageElementType.IMAGE and when it finds them it records the imageObjectId you will need that for the next function.
This function does the actual replacement and it requires the presentationId, the imageObjectId and the replacementUrl. And you will also have to enable the Advanced Slides API. It uses the batchUpdate but I haven't set it up to use more that one request just to keep it simple.
So the first function has most of the information you need except for the replacementUrl. The way I get this url is to upload any image that I want to use for pretty anything to the Photos Library. And sometimes the easiest thing to do is to download it to my computer and then upload it to the libary. Once it's in the library click on it and a darkened screen will open up to display the image. At this move over to the image and right click and select "Copy Image Address" and use that for your replacementUrl.
If you make any edits to the Slide Presentation then the imageObjectId's will probabaly change for that page and you may need to update them for this code to work. You can play with all of this on the API Explorer.