我不知道输出代码是什么。(I don't know what the output code is. The compiler says there is an invalid character in identifier of line 3)
b = 0 for a in range(0, 10, 2): b += a − 1 print(a," ",b)
我正在练习过去的论文。 请帮忙。 有人可以解释休息和继续功能。
b = 0 for a in range(0, 10, 2): b += a − 1 print(a," ",b)
I am practicing on a past paper. Please help. And can someone please explain the break and continue functions.
原文:https://stackoverflow.com/questions/37482960
最满意答案
正如您所发现的,电子表格的权限和脚本的权限不是一回事。
只能以匿名方式运行自定义函数,所有其他类型的脚本都需要某种经过身份验证的用户,并且可能需要授权才能访问私有数据。 添加菜单需要登录用户。 您的“操作”也可能需要授权,具体取决于调用的服务。
参考: 脚本的权限和类型 。
您可以找到解决此问题的方法,但不能在Sheets UI中找到解决方法。 例如,您可以将操作菜单发布为Web应用程序,该应用程序可用于匿名访问,但可以在您的授权下运行。
我选择要求您的用户拥有Google帐户。
Permissions for a Spreadsheet and permissions for scripts are not the same thing, as you've found.
Only custom functions can be run anonymously, all other types of scripts require an authenticated user of some sort, and possibly authorization to access private data. Adding menus will require a logged in user. Your "actions" may require authorization as well, depending upon what services are invoked.
Reference: Permissions and types of scripts.
You can find ways to work around this, but not within the Sheets UI. For example, you could publish a menu of actions as a web app, which would be available for anonymous access but would run under your authorization.
I'd opt for requiring your users to have a google account.
相关问答
更多-
谷歌电子表格得到补充(Google spreadsheet get complements)[2023-03-21]
有两个数组: Array1 Array2 1 1 2 b b 4 c 你可以得到结果数组: Result 2 4 c 试试这个公式: =FILTER(A2:A6,ROUND(MMULT(ArrayFormula(--(A2:A6<>TRANSPOSE(B2:B4))),TRANSPOSE(SPLIT(REPT(1/ROWS(B2:B4)&"/",Rows(B2:B4)),"/"))),5)=1) 对于这项任务可能过于复杂,有人可以编辑吗? ... -
从电子表格中运行谷歌脚本,但作为不同的用户?(Running a google script from within a spreadsheet, but as a different user?)[2024-04-12]
您无法通过控制对电子表格的访问来实现此目的。 最适合您的解决方案是让您的会计师根本不打开电子表格! 您可以在发送给会计师的电子邮件中嵌入HTML表单,他/她可以批准/拒绝该请求。 要了解如何构建此类系统,请参阅I / O 2011中的此视频http://www.youtube.com/watch?v=96URE_-aj-8 它演示了一个与您非常相似的用例。 You cannot do it by controlling access to the spreadsheet. The best solution ... -
在JSON的情况下,您可以通过将脚本上方的返回部分更改为以下代码来获得它。 return ContentService.createTextOutput(JSON.stringify(title)).setMimeType(ContentService.MimeType.JSON); In the case of JSON, you can be got it by changing return part above script to following code. return ContentSer ...
-
要发送电子邮件,您需要使用MailApp类: MailApp类 - Google文档 要从电子表格中获取数据,有一个SpreadsheetApp类: SpreadsheetApp类 - Google文档 您可以使用getActive()方法获取对当前活动电子表格的引用: getActive()电子表格方法 这将返回电子表格对象。 获得对当前电子表格的引用后,您可以获取活动工作表,并从活动工作表中获取二维数组值: getSheetValues方法 这是一个可能对您有帮助的StackOverflow问题: 按列 ...
-
共享谷歌电子表格时共享脚本选项“任何人都有链接”(Share script when sharing google spreadsheet with option “anyone with a link”)[2021-11-25]
正如您所发现的,电子表格的权限和脚本的权限不是一回事。 只能以匿名方式运行自定义函数,所有其他类型的脚本都需要某种经过身份验证的用户,并且可能需要授权才能访问私有数据。 添加菜单需要登录用户。 您的“操作”也可能需要授权,具体取决于调用的服务。 参考: 脚本的权限和类型 。 您可以找到解决此问题的方法,但不能在Sheets UI中找到解决方法。 例如,您可以将操作菜单发布为Web应用程序,该应用程序可用于匿名访问,但可以在您的授权下运行。 我选择要求您的用户拥有Google帐户。 Permissions f ... -
我尝试添加GoogleClock()参数,它似乎工作正常。 例如,在D2中: =COUNTIF(getColor("Neshig";GoogleClock()),"#00FF00") 这使它在一分钟内更新。 I tried adding the GoogleClock() parameter, and it seemed to work fine. For example, in D2: =COUNTIF(getColor("Neshig";GoogleClock()),"#00FF00") This ma ...
-
电子表格上的Google脚本 - 创建链接以通过表单修改答案(Google Script on a Spreadsheet - create a link to modify the answer via form)[2023-03-16]
您可以将表单中的数据写入电子表格,而不是使用表单中的链接到电子表格。 在表单给出的对象中,您将检索其ID并使用其ID,您将能够有效地将电子表格的条目链接到表单答案。 您可以查看此票证以了解更多如何处理表单答案。 如果您需要特定的信息(您将这样做)如何在表单提交时触发表单的响应,您可以检查此问题 。 为例: // for a form with 2 question named "question 1" and "question 2" function submitFormFunc(e) { var i ... -
将类似这样的内容放入附加到要使用的工作表的脚本中 function onEdit(e) { var range = e.range; if (range.getColumn() == '6') { var startingCell = SpreadsheetApp.getActiveSheet().getActiveCell(); var secondCell = startingCell.offset(0,1); var use ...
-
Google电子表格共享(Google spreadsheet sharing)[2023-11-03]
要使电子表格可用于Highcharts,需要将其发布到Web,以便可以执行回调脚本。 文件 - >发布到网络... To make the spreadsheet available for Highcharts it is required to publish it to the web, so the callback script can be executed. File -> Publish to the web... -
如何在Google电子表格中修改或复制共享屏幕(How to modify or duplicate the Share Screen in a google spreadsheet)[2023-05-07]
Kmt - 无法以编程方式控制“共享”屏幕。 你必须像在这里一样重建它。 关于你的doPost问题 - 我认为它有效。 我认为有一个记录器问题,在doPost中生成日志(异步不工作)。 尝试创建一个文件或附加到doPost中的电子表格,这将起作用。 Kmt - there is no way to control the Share screen programmatically. You'll have to rebuild it like you are doing here. Regarding yo ...