在参数列表后出现错误:"Missing".(第8行,文件“代码"). [英] Getting error: "Missing ) after argument list. (line 8, file "Code")"

查看:52
本文介绍了在参数列表后出现错误:"Missing".(第8行,文件“代码").的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误消息:参数列表后(,缺少")(第8行,文件代码")"当我运行我的代码时.

I am getting this error: "Missing ) after argument list. (line 8, file "Code")" When I run my code.

我尝试将ProfileNav-value周围的单引号切换为双引号,但也没有用.当我将第8行中的确切函数粘贴到工作表单元格中时,它可以工作,但是Google脚本不允许我运行它.

I've tried to switch around the single quotes around ProfileNav-value to double quotes and that did not work either. When I paste the exact function in line 8 into a shoot sheet cell, it works but google scripts does not let me run it.

function daily() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getSheetByName("BT");
  sh.insertRowAfter(2);
  sh.getRange("A3").setFormula('=TODAY()');
  sh.getRange("D3").setFormula('=VALUE(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(JOIN("",REGEXEXTRACT(LOWER(SUBSTITUTE(INDEX(IMPORTXML(C1,"//@content"),2),",",)),"(\\d*\\.*\\d+)([km]*)")),"\\.",),"k","00"),"m","00000"))');
  sh.getRange("E3").setFormula('=(D3-D4)/D3');
  sh.getRange("B3").setFormula('=query(IMPORTXML($D$1,"//span[@class='ProfileNav-value']/@data-count"),"limit 1 offset 2")');
  sh.getRange("C3").setFormula('=(B3-B4)/B3');

}

寻找第8行的工作方式.

Looking for a way for line 8 to work.

推荐答案

您需要转义单引号.这是通过 \ 完成的.

You need to escape the single quotation marks. This is done with a \.

sh.getRange("B3").setFormula('=query(IMPORTXML($D$1,"//span[@class=\'ProfileNav-value\']/@data-count"),"limit 1 offset 2")');

这篇关于在参数列表后出现错误:"Missing".(第8行,文件“代码").的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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