所以这就是我想要做的: 我有一个PDF文档的URL。我想将它直接存储到我的谷歌硬盘中,而不是先将其下载到我的硬盘上,然后再上传到谷歌硬盘。有谁知道如何做到这一点? 在此先感谢!!!
答案 0 :(得分:3)
使用urlFetch和DocsList,这非常简单,只需3行代码:
var urlOfThePdf = 'http://www.fostexinternational.com/docs/tech_support/pdfs/280_owners_manual.pdf';// an example of online pdf file
var folderName = 'GAS';// an example of folder name
function saveInDriveFolder(){
var folder = DocsList.getFolder(folderName);// get the folde
var file = UrlFetchApp.fetch(urlOfThePdf); // get the file content as blob
folder.createFile(file);//create the file directly in the folder
}