Range not found when using getRangelist

346 views
Skip to first unread message

Meng Shen

unread,
Jul 24, 2022, 7:00:16 AM7/24/22
to Google Apps Script Community
Hi,

I'm building a range list by creating a  rangeString  . Is there a way to pass it into the getRangeList method ? See below

var coord = [];
for ( i = 1 ; i <= lr ; i++){
if(condition){
coord.push('A${i}')
}}
var rangelist = spreadsheet.getRangeList(coord);
rangelist.clear();

I get this msg when i try to do so :

*Exception: Range not found*

Any help/suggestion will be appreciated

Tanaike

unread,
Jul 24, 2022, 8:23:05 AM7/24/22
to Google Apps Script Community
In your showing script, you are using coord.push('A${i}')

In this case, coord has ["A${i}","A${i}",,,]

I think that this is the reason for your issue of "Exception: Range not found".

In this case, please modify coord.push('A${i}') to coord.push(`A${i}`) and test it again. Ref

Meng Shen

unread,
Jul 24, 2022, 9:37:14 AM7/24/22
to Google Apps Script Community

thx, it really does help.
Reply all
Reply to author
Forward
0 new messages