Re: [詢問] 算表使用google app script可否輸出檔案

看板Google (谷歌Google)作者 (凹嗚嗚)時間2年前 (2022/06/24 12:48), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/2 (看更多)
我有用過一個輸出成pdf檔的語法 給你參考一下 應該 function convertSheetToPdf() { var sheetId = "這裡輸入你的試算表id"; //var SpreadSheet = SpreadsheetApp.openByUrl('https://docs.google.com/spreadshee ts/d/你的試算表id/edit#gid=0'); 這行應該不用 var destination = DriveApp.getFolderById("這裡輸入你要存放輸出的pdf的資料夾id" ); var url = "https://docs.google.com/feeds/download/spreadsheets/Export?key=" + sheetId + "&exportFormat=pdf"; var params = { method : "get", headers : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()}, muteHttpExceptions: true }; var blob = UrlFetchApp.fetch(url, params).getBlob(); blob.setName("你要的檔案名稱" + ".pdf"); destination.createFile(blob); } 沒記錯的話我當初應該是參考這個網站的語法 https://bit.ly/3OEScjS 看底下Answer那裡 ※ 引述《terrylove12 (空洞)》之銘言 : 想詢問會寫google app script的高手 : google 算表有沒有辦法輸出檔案 : 過去我常用excel +vba去做資料整理 : 然後透過vba的open & print 去輸出其他程式可以吃的txt : 如果想把該功能線上化 : 請問google app script 可否做到一樣的事情 ---- Sent from BePTT on my Samsung SM-G9980 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.236.50.113 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Google/M.1656046102.A.D3C.html

06/28 21:13, , 1F
06/28 21:13, 1F
文章代碼(AID): #1YjK8Mqy (Google)
文章代碼(AID): #1YjK8Mqy (Google)