I am inserting images on my google drive into sheets via their ID's.
However, when executing the code it always throws:
We're sorry, a server error occurred. Please wait a bit and try again. (line XX, file "TestCodeV1.0")
Where line XX has the code for insertImage(blobSource, column, row).
I have tested the FILE_ID of different images on my GDrive, and it works for images smaller or equal to 151 239 bytes, (img.getSize). For images larger than that it just throws the same error.
I have tried adding a delay between getFileByID and insertImage, however, that did not help (Thought it might be a 'still loading image blob' type of error).
I have tried to see if it is related to the images' pixel count or width/height.
The only factor seems to be the size (151 239 bytes)
var SPREADSHEET_URL = 'YOUR_SHEET_ID_HERE'
var SHEET_NAME= 'YOUR_SHEET_NAME_HERE'
var FILE_ID= 'YOUR_IMAGE_ID_HERE'
var ss = SpreadsheetApp.openById(SPREADSHEET_URL);
var sheet = ss.getSheetByName(SHEET_NAME);
var img = DriveApp.getFileById(FILE_ID).getBlob();
var image = sheet.insertImage(img, 1,1);
I expected the images the work be inserted easily. However, any image larger than 147KB failed with an error: "We're sorry, a server error occurred. Please wait a bit and try again."