服务错误:Google脚本上的电子表格 [英] Service Error: Spreadsheets on Google Scripts

查看:97
本文介绍了服务错误:Google脚本上的电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始编写一个脚本,它会对API进行链式调用(带有JSON响应)并将结果写入进入电子表格。



发生了什么:

,它运行得很好,没有大问题,但是一旦我从Spreadsheet按钮本身(从我创建的菜单)运行它,它将运行脚本的一些步骤,然后弹出:服务错误: Spreadsheet ,没有其他错误细节。



古怪

我开始将进程的当前步骤记录到Spreadsheet单元格,以便我可以在调试器运行脚本时监视其进度。



问题是,一旦我移动一些随机片段,如:

  sheet.getRange(F2)。setValue当前页面); 

代码会在不同点出现问题。



代码示例:

你可以在这里找到一个代码来重现这个问题: http://pastebin.com/HjmSwEYZ



您需要做的是:



1 - 在Google云端硬盘上创建新的电子表格



2 - 点击工具 - >脚本编辑器

3 - 创建一个新的脚本,粘贴代码并保存



4 - 重新加载电子表格(F5),以便自定义菜单将现在出现激战2跟踪器

5点击按钮并点击全部列出

所需输出:



此代码应该(如果不是此错误) p>

1 - 在此网址上执行请求: http://www.gw2spidy.com/api/v0.9/json/it ems / all / 1 (它将返回激战2的第一页itens)

2 - 遍历每个页面,解析json并写入返回到电子表格中的值



免责声明: p

表中的消息。这是一个绝望的尝试来跟踪我的进展,我知道我不应该这样做。



预先感谢

更新1:



在创建另一个电子表格并将pastebin代码粘贴到自己的脚本项目中后,我可以在交互中运行它,但就是这样。这一次,它引发了一个不同的错误:很抱歉,发生服务器错误。请稍等,再试一次。

解决方案

我喜欢ellockie所说的 - 我(不知不觉) )有同样的问题。我试图range.sort(8),但为了收集范围,我用:

$ $ $ $ $ $ $ sheet.getRange(2, 1,sheet.getMaxRows(),sheet.getMaxColumns());

但我应该使用的是:

  sheet.getRange(2,1,sheet.getMaxRows() -  1,sheet.getMaxColumns()); 

截至2015年5月1日的错误信息仍然非常神秘,并且没有提供进一步的详细信息比服务错误:电子表格。


Scope

I started to write an script that will make chained calls to an API (with a JSON response) and write the result into a Spreadsheet.

What Happens:

Once i debug the script code, it runs just fine, with no major problem, but once i run it from the Spreadsheet button itself (from the menu i created) it runs some steps of the script and than, pops a : Service Error: Spreadsheet with no other error details.

Weirdness

I Started to "Log" the current step of the process to a Spreadsheet cell, so that i can monitor its progress while running the script out of the debugger.

The problem is, once i move some "random" pieces such as :

sheet.getRange("F2").setValue(currentPage);

the code tends to break in different points.

Code Sample :

You can find a code to reproduce the issue here : http://pastebin.com/HjmSwEYZ

All you have to do is :

1 - Create a new Spreadsheet on Google Drive

2 - Hit Tools -> Script Editor

3 - Create a new Script, paste the code in, and save

4 - Reload the Spreadsheet (F5) so that the custom menu will now appear "Guild Wars 2 Tracker"

5 - Click the button and hit "List All"

Desired Output:

What this code should (if it wasn't for this error) do is :

1 - Execute a request on this url : http://www.gw2spidy.com/api/v0.9/json/items/all/1 (which will return the first page of Guild Wars 2 itens)

2 - Iterates over each page, parsing the json and writing the returned values into the Spreadsheet

Disclaimer:

Sorry about all the "Log" messages in the sheet. This was a desperate attempt to track my progress, i know i should't do this.

Thanks in advance

Update 1:

After creating another Spreadsheet and pasting the pastebin code in its own Script Project i could run it for on interaction, but that was it. This time thus, it raised a different error : We're sorry, a server error occurred. Please wait a bit and try again.

解决方案

I like what ellockie said - I was (unwittingly) having the same problem. I was trying to range.sort(8), but to collect the range, I used:

sheet.getRange(2,1,sheet.getMaxRows(), sheet.getMaxColumns());

But what I should have used was:

sheet.getRange(2, 1, sheet.getMaxRows()-1, sheet.getMaxColumns());

The error message, as of 5/1/2015, still is very cryptic and offers no further details than the "Service error: Spreadsheets".

这篇关于服务错误:Google脚本上的电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆