在 google sheet 上获取不受保护范围的 A1Notation

get A1Notation of unprotected range on google sheet

有没有办法获取 A1Notation 中 sheet 的未受保护单元格的范围? 我有这个功能,但不显示 A1Notation,我不知道还能做什么:

 function parametrosdeProceso() {

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


}

试一试sheet

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

整个价差sheet

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