久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Drive API/DriveApp 將 PDF 轉換為 Google 文檔

Using Drive API / DriveApp to convert from PDFs to Google Documents(使用 Drive API/DriveApp 將 PDF 轉換為 Google 文檔)
本文介紹了使用 Drive API/DriveApp 將 PDF 轉換為 Google 文檔的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

此問題已成功解決.我正在編輯我的帖子以記錄我的經驗,以供后人參考.

This problem has been successfully resolved. I am editing my post to document my experience for posterity and future reference.

我有 117 個 PDF 文件(平均大小約為 238 KB)上傳到 Google 云端硬盤.我想將它們全部轉換為 Google Docs 并將它們保存在不同的 Drive 文件夾中.

I have 117 PDF files (average size ~238 KB) uploaded to Google Drive. I want to convert them all to Google Docs and keep them in a different Drive folder.

我嘗試使用 Drive.Files.insert.但是,在大多數情況下,只有 5 個文件可以通過這種方式在函數因此錯誤過早過期之前進行轉換

I attempted to convert the files using Drive.Files.insert. However, under most circumstances, only 5 files could be converted this way before the function expires prematurely with this error

超出限制:DriveApp.(第 # 行,文件代碼")

Limit Exceeded: DriveApp. (line #, file "Code")

上面引用的行是調用 insert 函數的地方.第一次調用此函數后,后續調用通常會立即失敗,并且沒有創建額外的 google doc.

where the line referenced above is when the insert function is called. After calling this function for the first time, subsequent calls typically failed immediately with no additional google doc created.

我使用了 3 種主要方法來實現我的目標.一個是使用 Drive.Files.insert,如上所述.另外兩個涉及使用 Drive.Files.copy 并發送 一批 HTTP 請求.最后兩種方法是 Tanaike 建議的,我建議閱讀下面的答案以獲取更多信息.insertcopy 函數來自 Google Drive REST v2 API,而批處理多個 HTTP 請求來自 Drive REST v3.

I used 3 main ways to achieve my goal. One was using the Drive.Files.insert, as mentioned above. The other two involved using Drive.Files.copy and sending a batch of HTTP requests. These last two methods were suggested by Tanaike, and I recommend reading his answer below for more information. The insert and copy functions are from Google Drive REST v2 API, while batching multiple HTTP requests is from Drive REST v3.

使用 Drive.Files.insert,我遇到了處理問題具有執行限制(在上面的問題部分中進行了解釋).一種解決方案是多次運行這些功能.為此,我需要一種方法來跟蹤哪些文件被轉換.我有兩個選擇:使用電子表格和 延續令牌.因此,我有 4 種不同的方法來測試:本段中提到的兩種,批處理 HTTP 請求,并調用 Drive.Files.copy.

With Drive.Files.insert, I experienced issues dealing with execution limitations (explained in the Problem section above). One solution was to run the functions multiple times. And for that, I needed a way to keep track of which files were converted. I had two options for this: using a spreadsheet and a continuation token. Therefore, I had 4 different methods to test: the two mentioned in this paragraph, batching HTTP requests, and calling Drive.Files.copy.

因為團隊驅動器的行為不同于常規驅動器,我覺得有必要嘗試每種方法兩次,其中包含 PDF 的文件夾是常規的非團隊驅動器文件夾,另一種方法是該文件夾位于團隊驅動器下.總的來說,這意味著我有 8 個不同的測試方法.

Because team drives behave differently from regular drives, I felt it necessary to try each of those methods twice, one in which the folder containing the PDFs is a regular non-Team Drive folder and one in which that folder is under a Team Drive. In total, this means I had 8 different methods to test.

這些是我使用的確切功能.每個都使用了兩次,唯一的變化是源文件夾和目標文件夾的 ID(出于上述原因):

These are the exact functions I used. Each of these was used twice, with the only variations being the ID of the source and destination folders (for reasons stated above):

function toDocs() {
  var sheet = SpreadsheetApp.openById(/* spreadsheet id*/).getSheets()[0];
  var range = sheet.getRange("A2:E118");
  var table = range.getValues();
  var len = table.length;
  var resources = {
    title: null,
    mimeType: MimeType.GOOGLE_DOCS,
    parents: [{id: /* destination folder id *
                
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 欧美性生交大片免费 | 在线观看电影av | 色五月激情五月 | 操操日 | 精品视频在线一区 | 99re在线| 国产良家自拍 | 亚洲精品在线视频 | 免费观看一级毛片 | 国产精品一二三区在线观看 | av网站免费在线观看 | 精品免费看| 亚洲天堂av在线 | 中文字幕不卡在线88 | 午夜精品久久久久久久久久久久 | 91九色在线观看 | 亚洲精品久久久久久久久久久 | 欧美一区视频在线 | 国产在线精品一区二区 | 国产高清精品一区二区三区 | 91原创视频 | 超碰国产在线 | 国内精品久久影院 | 久久精品无码一区二区三区 | 成人在线精品 | 免费在线观看一区二区三区 | 精品国产视频 | 成人午夜黄色 | 国产精品久久久久久影视 | 亚洲444eee在线观看 | 久久精品免费一区二区 | 欧美三区| 精品一区二区免费视频 | 一区二区在线不卡 | 日韩精品成人 | 国产日韩精品视频 | 日日草夜夜草 | 日韩国产一区二区三区 | 日韩精品免费在线 | 亚洲视频一区二区三区 | 成人福利网 |