admin管理员组文章数量:1399997
so I am trying to make my code work. It does... sometimes.
The code is:
function getAntallVakter(tabell, navn) {
var antall = 0;
for(i = 0; i<tabell.length;i++){
for(j=0;j<tabell[i].length;j++){
if(tabell[i][j].indexOf(navn)>-1){
antall += 1;
}
}
}
return antall;
}
It does work when I tested it, but when I used it on the spreadsheet that needs this script it doesn't work for the given range. It does work on other ranges. On the specific ranges it doesn't work I got some of these error:
TypeError Cannot find function indexOf in object 0 (Line 7 in Code.gs)
TypeError Cannot find function indexOf in Thu Jan 01 2015 00:00:00 GMT+0100 (CET).
I appreciate any help I get.
so I am trying to make my code work. It does... sometimes.
The code is:
function getAntallVakter(tabell, navn) {
var antall = 0;
for(i = 0; i<tabell.length;i++){
for(j=0;j<tabell[i].length;j++){
if(tabell[i][j].indexOf(navn)>-1){
antall += 1;
}
}
}
return antall;
}
It does work when I tested it, but when I used it on the spreadsheet that needs this script it doesn't work for the given range. It does work on other ranges. On the specific ranges it doesn't work I got some of these error:
TypeError Cannot find function indexOf in object 0 (Line 7 in Code.gs)
TypeError Cannot find function indexOf in Thu Jan 01 2015 00:00:00 GMT+0100 (CET).
I appreciate any help I get.
Share Improve this question asked Jan 15, 2015 at 15:44 user3685412user3685412 4,5773 gold badges17 silver badges16 bronze badges1 Answer
Reset to default 7I can't belive I totally forgot to check weather the cells are strings or not.
adding the line
var text = tabell[i][j].toString();
before the if-sentence fixed everything.
本文标签:
版权声明:本文标题:javascript - Google Spreadsheet: TypeError Cannot find function indexOf in object 0 (Line 7 in Code.gs) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744237510a2596625.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论