我们正在使用office将数据写入表。在2016年11月底之前,excel上的代码运行良好,之后就停止了工作。
该代码只是将值设置为一个表,它试图写入的单元格总数小于10,000,而设置该值的方法是:
dataTable.getHeaderRowRange().values = [data.headerValues];
dataTable.getDataBodyRange().formulas = data.values;
dataTable.getTotalRowRange().formulas = [data.totalRow];
用于再现问题的完整代码托管在GitHub中。
您可以使用下面的清单在office运行代码:
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TaskPaneApp">
<Id>5B1D06A5-5F14-4B8F-B07D-E698084397F6</Id>
<Version>1.0.0.0</Version>
<ProviderName>Provider</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Testing Office API" />
<Description DefaultValue="Testing Office API"/>
<Hosts>
<Host Name="Workbook" />
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://renil-abdulkader.github.io/office-js-api-testing/" />
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
</OfficeApp>
单击Load按钮只会写入部分数据,控制台将显示以下错误:{"name":"OfficeExtension.Error","code":"GeneralException","message":"There was an internal error while processing the request.","traceMessages":[],"debugInfo":{"errorLocation":"Range.formulas"}}
。
一旦发生这种情况,其他问题是:
You are no longer connected to the server
错误消息。更新1:我们正在编写68行,每行有136列。更新了代码以编写前40行和最后30行,该代码运行良好,但不是全部68行。所以数据本身不应该有问题。
发布于 2017-01-12 22:41:20
这是由于在线平台上的超时错误造成的.作为一个缓解步骤,是否有可能以块的形式进行大的公式(或值)更新,这样就不会有单个请求遇到超时问题?块的大小可能取决于环境。可能是2K细胞开始?如果我们能够提供另一种解决方案,我将跟进这个线程。
https://stackoverflow.com/questions/41493477
复制相似问题