将Google文档集成到网站中以进行内容创建

问题描述 投票:16回答:6

我正在建立一个自我发布的网站。我想将Google文档集成到我的网站中,并允许每个发布者/作者从我的网站上写下她/他的书,然后从我的网站或直接从谷歌文档更新内容,并保持两个版本的内容同步。

这可能吗?谢谢!

google-docs google-docs-api
6个回答
11
投票

是的,这是可能的。

您可以使用Google Documents List API获取Google文档内容,并上传新内容。

如果您在Google文档之外进行编辑,则您当前必须自己手动执行同步,在这种情况下,您将重新上传文件内容。


3
投票

使用Google API执行此操作的新方法。 (www.cloudward.com) - 使用一种名为EASE的语言的代码片段可以在程序上执行此操作(使用文档和工作表更像数据库然后文档)。

在EASE中发布您的Google文档的声明(您可以在网页中嵌入此声明)如下所示:

 <# include processed google doc "My Book"; #>

每当您的用户更新文档时,它都会自动发布。片段可以被缓存,因此它也比使用Google Publish选项更快(并且当Google发布时文档看起来更好)

这种方法的好处在于可以通过编程控制来解决这个问题。例如,您可以在Google表格中构建已发布图书的列表:(列:图书标题,作者,Google文档名称,已发布(是,否)

<body>
<!-- Open and start a query from a named Google Sheet -->
<# start list for googlesheet "Published Books"; 
    include when published is "yes";
#>

<!-- header of our list -->
<# start header #>
    <table>
        <th>Book</th>
        <th>Author</th>
        <th></th>
    </tr>
<# end header #>

<!-- For each row in the sheet list a line in our table with contents of 
     the sheet and link to a new page to duplay the actual book - passing 
     the book name as a param -->
<# start row #>
    <tr>
        <td><# Book Title #></td>
        <td><# Author #></td>
        <td><a href='<# snippet "Read Book" #>&bookname=<# Google Doc Name #>'>Open Book</a></td>
    </td>
<# end row #>

<!-- Close out our list -->
<# start footer #>
   </table>
<# end footer #>

<# end list #>              
</body> 

这将调用第二页实际显示该书:

<body>
   <!-- bookname is a URL param passed and use as a variable -->
   <# include processed google doc "<#[url.bookname]#>"; #>
</body>

0
投票

是的这可以通过包含Google的API和SDK来完成。如果您使用的是c#(ASP .net)/ Java(JSP / HTML)等语言,则需要在项目中安装.dll之后导入/包含引用。

注意:要使用任何Google的产品(电子邮件,地图,日历,...),您需要使用密码来获取密码,该密码可以通过使用某些Google电子邮件进行记录并生成API密钥来获取。您将获得加密代码作为您的应用程序/项目运行的关键。

using Google.GData.Client;
using Google.GData.Documents;

namespace MyDocumentsListIntegration
{
  class Program {
    static void Main(string[] args)
    {

      // Application code here

    }
  }
}

请参阅以下链接:

API参考:Click Here

详细参考:Click Here


0
投票

是的,这是可能的。

您可以使用Google.GData.Client和Google.GData.Documents nuget包获取Google文档内容,并上传新内容

你可以找到这个链接here的完整信息


0
投票

如果你打算用Python写,我发现gspread很有用。


-2
投票

我们使用Google Docs作为我们网站的CMS,其中包含名为Feed.Us的应用程序。我们的网站是Php,但Feed.us与其他脚本语言一起使用。

© www.soinside.com 2019 - 2024. All rights reserved.