Google Docs脚本

编程入门 行业动态 更新时间:2024-10-27 11:19:47
Google Docs脚本 - setValue上缺少自动提取器的括号(Google Docs Scripts - Missing parenthesis on setValue for autorefresher)

我只使用一个脚本将setValue设置为“”,然后设置一个Importrange公式。 基本上我这样做是为了让数据更新更快,因为我将为每5分钟设置一次触发器。

我收到一条关于缺少括号的错误消息。 我已经读过关于将“+”插入字符串但我不知道如何将其添加到此表达式中。

任何人都可以帮助我吗?

*function UpdateTarget() { var ss = SpreadsheetApp.getActive(); var sheet = ss.getSheetByName("Teste"); sheet.getRange("B4").setValue(""); sheet.getRange("B4").setFormula("=importrange("1pG8nVt-wB4Sf4KvaXT_-0";if(day(today()-weekday(today())+2)<10;"0"&day(today()-weekday(today())+2);day(today()-weekday(today())+2))&"."&if(month(today()-weekday(today())+2)<10;"0"&month(today()-weekday(today())+2);month(today()-weekday(today())+2)) &"."&if(year(today()-weekday(today())+2)<10;"0"&year(today()-weekday(today())+2);YEAR(today()-weekday(today())+2))&"!BY34:KF83")"); }*

提前致谢!

蓝天,

I'm stuck with a single script just to setValue as "" and then set a formula of Importrange. Basically i'm doing this to have the data update quicker as i will set a trigger for each 5 minutes.

I'm receiving an error message about missing parenthesis. I've read about inserting the "+" into string but i don't see how can i do it into this expression.

Can anyone help me out on that?

*function UpdateTarget() { var ss = SpreadsheetApp.getActive(); var sheet = ss.getSheetByName("Teste"); sheet.getRange("B4").setValue(""); sheet.getRange("B4").setFormula("=importrange("1pG8nVt-wB4Sf4KvaXT_-0";if(day(today()-weekday(today())+2)<10;"0"&day(today()-weekday(today())+2);day(today()-weekday(today())+2))&"."&if(month(today()-weekday(today())+2)<10;"0"&month(today()-weekday(today())+2);month(today()-weekday(today())+2)) &"."&if(year(today()-weekday(today())+2)<10;"0"&year(today()-weekday(today())+2);YEAR(today()-weekday(today())+2))&"!BY34:KF83")"); }*

Thanks in advance!

Blue skies,

最满意答案

你只是有不匹配的报价。 在双引号内使用单引号。 它只是一个标准的JavaScript语法错误。

You simply have mismatched quotes. Use single quotes inside the double quotes. Its just a standard javascript syntax error.

更多推荐

本文发布于:2023-07-20 06:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1195217.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   Google   Docs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!