Home > database >  get A1Notation of unprotected range on google sheet
get A1Notation of unprotected range on google sheet

Time:05-20

Is there a way to get the range of a unprotected cells of a sheet in A1Notation? I have this function but don't show me the A1Notation, and I don't know what more do:

 function parametrosdeProceso() {

var ss = SpreadsheetApp.getActiveSpreadsheet();
var hoja = ss.getSheetByName("KMD108");
var protection = hoja.protect();
var unprotected= protection.getUnprotectedRanges();
 
Logger.log(unprotected);


}

CodePudding user response:

Try

function listOfUnprotectedRanges() {
  var p = SpreadsheetApp.getActiveSheet().getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
  var ranges = p.getUnprotectedRanges().map(r => r.getA1Notation())
  console.log(ranges)
}
  • Related