我想从网络下载图片到一个驱动器文件夹,只需编写图像链接。例如,我想下载的图像是在一个驱动器文件夹自动与谷歌应用程序脚本。
https://i.imgur.com/QCFXhpg.jpg
这就像一种网络抓取,在其中我得到的图片,上述网站在一个文件夹。
function myFunction() {
var destination_id = '1cgzNUb88ZHXSQ7iZ0zYigH1f7KD_7geH' //// Id of the folder in which we are going to store the image
var img = ...;
var destination = DriveApp.getFolderById(destination_id)
destination.createFile(img)
}发布于 2021-10-06 00:48:55
在这种情况下,我认为可以使用UrlFetchApp检索图像。因此,对于您的脚本,下面的修改如何?
发自:
var img = ...;至:
var img = UrlFetchApp.fetch("https://i.imgur.com/QCFXhpg.jpg").getBlob();参考资料:
https://stackoverflow.com/questions/69458614
复制相似问题