所以我想写一个谷歌脚本,将创建一个图像文件从谷歌驱动器上的3个不同的图像文件。我决定使用的方法是在Drive中创建一个模板或基本gDraw文件,然后修改该文件并将其导出为jpeg。到目前为止,我已经能够使用此文章的代码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?将我的gDraw文件导出为图像。谷歌脚本替换gDraw文件中的图像
function gDrawTO_jpeg(){
var gDrawFile = Drive.Files.get('1P2qYTyeI9RovsI_qwiMEtlBeTJw-exjckQeYLL_NA7w');
var url = gDrawFile.exportLinks['image/jpeg'];
var token = ScriptApp.getOAuthToken();
var response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + token
}
});
var jpeg = response.getBlob();
// save drawing as jpeg file to Drive, or do whatever you need to with the blob
DriveApp.createFile(jpeg);
}
我一直在试图弄清楚如何替换gDraw文件中的图像。
在此先感谢您的帮助!