I am trying to use google apps script to make a google document full of images with the name of the image beneath each one. All of the images are in a google drive folder. Here is what I have tried:
function myFunction() {
var doc = DocumentApp.create('This document is a test');
var body = doc.getBody();
var folderID = 'FOLDER_ID_HERE';
var folder = DriveApp.getFolderById(folderID);
var contents = folder.getFiles();
var file;
while (contents.hasNext()){
var file = contents.next();
var name = file.getName();
var url = file.getUrl();
body.appendParagraph(name);
//Add image to document here somehow???
}
doc.saveAndClose();
}
What's the correct way to load an image from file here?