我正在使用 Google Apps 脚本来处理电子表格。我的代码不起作用,所以我正在努力解决这些错误。它应该将电子表格的值复制到一个数组中,在数组中进行一些更改,然后使用这些更改重新编写电子表格的某些部分并重新格式化其他部分。
作为我的错误检查的一部分,我尝试在完成所有所需的更改后将数组写回电子表格中的单元格。当我这样做时,我在问题标题中得到错误:
error: Matrix is not rectangular {" ","Score","Max Poss.","","","","asdf","","","","","","","";"Steve:",1,133,"","","","eFEf","","","","","","","";"Chris:",0,126,"","","","First we test the color change.","","","","","","","";"Tyler:",5,130,"","","","And now let's see...","","","","","","","";"Billy:",3,127,"","","","df","","","","","","","";"Drew:",0,122,"","","#N/A","gtttt","","","","","","","";"Yllib:",9,133,"","","","vrrr","","","","","","","";"","","","","","","","","","","","","","";"-W/L-","Drew","Steve","Chris","Tyler","Billy","HOME","AWAY","Billy","Tyler","Chris","Steve","Drew","-W/L-";"l",4,"",4,6,"","","",3,"","",1,"","w";"W","","","",5,"","","",9,"",6,3,5,"l";"",3,12,2,2,2,"","","","","","",""," ";"","","","","","","","",11,1,5,8,6," ";"",10,15,15,8,13,"","","","","","",""," ";"",8,10,14,16,12,"","","","","","",""," ";"","","","","","","","",10,14,10,16,14," ";"",13,13,11,13,16,"","","","","","",""," ";"","","","",4,"","","",4,"",9,6,16," ";"","",9,"","","","","",1,3,8,"",9," ";"","","","","","","","",8,12,13,2,12," ";"","","",1,"",5,"","","",11,"",4,1," ";"","","","","","","","",15,10,12,14,11," ";"",2,"",3,"",6,"","","",9,"",5,""," ";"W";"",2,"",7,7,7,"NYG -2.5","","","","",7,""," "}
我尝试使用 var sheetArray = new Array (30); 创建数组 和 var sheetArray = []; 结果相同。
我在谷歌上出现的次数不多。我想我的大问题是我是否收到此错误是因为我试图在不兼容的电子表格单元格中显示一个矩形数组,或者问题是否与创建数组本身或与其他方面无关展示。