get A1Notation of unprotected range on google sheet


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();



Try, for one sheet

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

for the whole spreadsheet

function listOfUnprotectedRanges() {
  var p = SpreadsheetApp.getActiveSpreadsheet().getProtections(SpreadsheetApp.ProtectionType.SHEET);
  p.forEach(x => {
    var ranges = x.getUnprotectedRanges().map(r => r.getA1Notation())

Answered By – Mike Steelson

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published