Google apps script 谷歌应用程序脚本-查询(导入)函数返回;对象不允许更新或更改属性;

Google apps script 谷歌应用程序脚本-查询(导入)函数返回;对象不允许更新或更改属性;,google-apps-script,Google Apps Script,我不知道自己做错了什么,希望能得到一些帮助。我认为,问题在于cellA.setFormula行。当我尝试执行此函数时,出现异常-“对象不允许更新或更改属性”: function getInfo() { //this code used for blue triangle Get Info button. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0];

我不知道自己做错了什么,希望能得到一些帮助。我认为,问题在于cellA.setFormula行。当我尝试执行此函数时,出现异常-“对象不允许更新或更改属性”:

    function getInfo() {
    //this code used for blue triangle Get Info button.  
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];

    var cellA = sheet.getRange("B2");
    cellA.setFormula=("=Query(importRange(\"0Ant11dssJanWdHdhREdjMFgyVDI0OTBIR1BybWRLbkE&usp\";\"Form Responses!A2:AN400\");\"Select Col1,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17,Col18,Col19,Col20,Col21,Col22,Col23,Col24,Col25,Col26,Col27,Col28,Col29,Col30,Col31,Col32,Col33,Col34,Col35,Col36,Col37,Col38,Col39,Col40 Where Col4 = '\"&A2&\"' \")");

    }

因为它是无效的javascript。删除setFormula之后的额外“=”。

我使用了这个系统:

SpreadsheetApp.openById(将ID放在这里).getRange('A1').setValue('=IMPORTRANGE(

您可以将您的设置更改为:
cellA.setValue(..

我希望这有帮助