Марина Asked:2024-03-19 15:30:31 +0000 UTC2024-03-19 15:30:31 +0000 UTC 2024-03-19 15:30:31 +0000 UTC 是否可以通过应用程序脚本下载文件? 772 我在文档中没有找到(或者没有看到),是否可以通过GAS下载文件?如果有的话,请告诉我它的功能。 google-apps-script 1 个回答 Voted Best Answer oshliaer 2024-03-19T16:42:10Z2024-03-19T16:42:10Z 看起来应该不会有什么问题 function getFile_(fileURL) { const response = UrlFetchApp.fetch(fileURL); const fileBlob = response.getBlob(); const folder = DriveApp.getRootFolder(); const result = folder.createFile(fileBlob); return result; } function userActionRun() { const url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTs4lzQVposg0CeIrcEHWLzcsay1lW8gq0p4-c7x-51WL37n54TvzUwhwraSb-BdZNtCJ6GLYoYr4T1/pub?gid=1270070159&single=true&output=csv'; const file = getFile_(url); console.log(file.getUrl()); }
看起来应该不会有什么问题