suo*_*onA 6 command-line format-conversion google-drive doc
我如何从 Google Docs 捕获文档中的所有文本并将其转换为文本文件,最好是一种可以在脚本中使用的方式?会wget工作吗?如:
wget https://docs.google.com/document/d/documentcode > googledoc.txt
Run Code Online (Sandbox Code Playgroud)
如果是这样,我可以使用缩短的 URL 吗?
小智 9
无需通过管道连接到其他程序来转换文件。您可以使用 URL 地址中的现有参数以任何受支持的格式从 Google 文档下载。
\n\nhttps://docs.google.com/document/d/FILE_ID/export?format=FORMAT\nRun Code Online (Sandbox Code Playgroud)\n\n在哪里:
\n\nFILE_ID是目标文件的字符串 ID;FORMAT是选择的文件格式,即txtwget然后,使用Web 浏览器可以直接从 Google Docs 下载文本文件。两种方法都会按预期将文档下载为文本文件。
我自己尝试过,输出看起来像这样:
\n\n$ wget https://docs.google.com/document/d/FILE_ID/export?format=txt\n--####-##-## ##:##:##-- https://docs.google.com/document/d/FILE_ID/export?format=txt\nResolving docs.google.com (docs.google.com)...\nConnecting to docs.google.com (docs.google.com)... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: unspecified [text/plain]\nSaving to: \xe2\x80\x98export?format=txt\xe2\x80\x99\n\n [ <=> ] 649 --.-K/s in 0s \n\n####-##-## ##:##:## (##.# MB/s) - \xe2\x80\x98export?format=txt\xe2\x80\x99 saved [649]\nRun Code Online (Sandbox Code Playgroud)\n\n其他产品(例如 Google 表格、Google 演示文稿甚至 Google 云端硬盘)的 URL 地址会略有不同。
\n\n就文档而言,我找到的唯一相关指南是这篇 2014 年左右发表的过时的博客文章。有此页面的 Google Drive 开发人员指南,但没有用。就这些。
\n小智 0
将 Google 文档下载为 Word 文档,文件扩展名为 .docx。确保您已安装 docxtxt 软件包。然后运行 docx2txt 命令,后跟文件名。例如...
docx2txt report.docx