【问题标题】:create empty spreadsheet in google docs在谷歌文档中创建空电子表格
【发布时间】:2010-12-20 21:34:10
【问题描述】:

我想使用 google docs api 创建一个空的电子表格,但出现错误:无法转换文档。

$xml = "--END_OF_PART\r\n".
        "Content-Type: application/atom+xml;\r\n\r\n".      
        "<?xml version='1.0' encoding='UTF-8'?>
        <entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:docs=\"http://schemas.google.com/docs/2007\">
          <category scheme=\"http://schemas.google.com/g/2005#kind\"
              term=\"http://schemas.google.com/docs/2007#spreadsheet\"/>
            <title>".$name."</title>
        </entry>\r\n".  
        "--END_OF_PART\r\n".
        "Content-Type: text/csv;\r\n\r\n".
        "--END_OF_PART--\r\n";

这个 xml 被发送到谷歌的服务器,带有一个带有参数 convert=true 的帖子 然后我得到了错误:无法转换文档。 当我使用 mime 类型“application/vnd.oasis.opendocument.spreadsheet”而不是“text/csv”并且不添加参数 convert=true 时,我得到一个内部错误。

【问题讨论】:

    标签: php xml google-sheets


    【解决方案1】:

    文档列表 API v3 已弃用。请改用 Google Drive API。您可以使用插入调用创建文件:

    https://developers.google.com/drive/v2/reference/files/insert

    原生电子表格的 mimeType 是:

    application/vnd.google-apps.spreadsheet

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-03
      • 1970-01-01
      • 2011-07-30
      • 2017-04-28
      • 2014-07-01
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多