We encountered an image URL failure error in two scenarios in App Sheet:
First Case:
- Sometimes, duplicate images are created with the same file name, but one of them has a size of 0 KB.
- As a result, the image does not display in the app, and the App Sheet image URL with a signature cannot be used for inserting the image into Google slide when creating a presentation using Apps Script.
- When we paste the image URL into a browser, it returns an error in HTML format.
Please check the following error message and code:
Code:
Slides. Presentations. batch Update ({
requests: requests
}, copy. get Id());
"requests" array contains the create image requests for insert images in google slide.
Error:
{ [API call to slides. presentations. batch Update failed with error: Invalid requests[110].create Image: The provided image was not found.]
details:
{ code: 400,
message: 'Invalid requests[110].create Image: The provided image was not found.' } }
Second Case:
- This issue occurs when fetching images using the fetch All method to retrieve image blobs.
In this case, the image URLs open correctly in a browser, and images are displayed in the app. - Also status code of image URL is 200.
Please check the following error message and code:
Code:
const image_blob_array = URL Fetch App. fetch All(images_URLs);
"images URLs" is an array of app sheet image URLs.
Error:
{ [: API call to slides. presentations. batch Update failed with error: Invalid requests[87].create Image: There was a problem retrieving the image. The provided image should be publicly accessible, within size limit, and in supported formats.]
name: 'Google Response Exception',
details:
{ code: 400,
message: 'Invalid requests [87].create Image: There was a problem retrieving the image. The provided image should be publicly accessible, within size limit, and in supported formats.' } }
Anybody know a solution for this?
Thanks in advance.
Ensure Image Upload Completeness
Use Google Drive Public URLs Instead of AppSheet URLs
You can generate a public link via Apps Script:
function getDriveImageUrl(fileId) {
return "https://drive.google.com/uc?id=" + fileId;}
Check Image URL in Incognito Mode
Re-Upload the Image When 0 KB is Detected
Test URLs in Apps Script Before Sending to Google Slides
Run this test script:
function testImageUrls() {
var urls = ["YOUR_APPSHEET_IMAGE_URL"];
var response = UrlFetchApp.fetch(urls[0]);
Logger.log(response.getResponseCode()); // Should return 200
Logger.log(response.getHeaders());}
Convert AppSheet URLs to Public URLs
Example Apps Script to move images to Drive:
function saveImageToDrive(imageUrl) {
var response = UrlFetchApp.fetch(imageUrl);
var blob = response.getBlob();
var folder = DriveApp.getFolderById("YOUR_FOLDER_ID");
var file = folder.createFile(blob);
return file.getId(); // Return the file ID for further use}
Reduce Image Size
Use Individual UrlFetchApp.fetch Instead of fetchAll
Instead, try fetching URLs one by one:
for (var i = 0; i < image_URLs.length; i++) {
var response = UrlFetchApp.fetch(image_URLs[i]);
if (response.getResponseCode() == 200) {
var blob = response.getBlob();
// Process and insert into Google Slides }}
User | Count |
---|---|
15 | |
14 | |
8 | |
7 | |
4 |