I need to convert google doc files into jpeg files and then save them in my google drive.
i have found code that fixes a similar problem 1)Is there a Google Appscript command that can convert a .gDraw to a .jpg? 2)Can a trigger be set to perform this conversion on .gdraw file edit? here but I am not sure how use a google doc file instead of a gDraw file
function gDrawTO_jpeg(){
var gDrawFile = Drive.Files.get('your_draw_file_ID_here');
var url = gDrawFile.exportLinks['image/jpeg'];
var token = ScriptApp.getOAuthToken();
var response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + token
}
});
var jpeg = response.getBlob();
DriveApp.createFile(jpeg);
}