Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Sheet.getRangeList.

912 views
Skip to first unread message

iIformações De Convênios

unread,
Dec 23, 2022, 8:36:46 AM12/23/22
to Google Apps Script Community
I'm trying to get a cell variable to use in getRangeList(), but apparently it's not possible, or I'm totally wrong. The idea is for the user to inform which intervals will be selected

function myFunction() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  const sheet = ss.getSheetByName('Página4');
 const rangeList = ss.getRange('F1').getValue();


  valor = "[" + rangeList.toString() + "]";
  
  console.log(valor);
  
  sheet.getRangeList(valor).activate;
    
  
 
 
}

Screenshot_1.png

Stuart Smith

unread,
Dec 28, 2022, 7:42:57 AM12/28/22
to Google Apps Script Community
Hi there, this works:

function myFunction() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheetByName('Page4');
sheet.getRangeList(['F1']).activate();
}

getRangeList expects a list of strings, each string being a cell or range reference in A1/R1C1 notation.  If you want more than one range you could do:

sheet.getRangeList(['F1','B4','A1:B2'])
etc

Hope that helps.
Reply all
Reply to author
Forward
0 new messages