サービス
サービスを探す
プロ人材を探す
仕事を探す
ブログを探す

const book = SpreadsheetApp.getActiveSpreadsheet();
const sheet = book.getActivesheet();
const protect = sheet.getRange(row,col,row2,col2).protect();
//オーナーは必ず権限を持つので注意
protect.addEditor(email); //単一ユーザー登録時
protect.addEditors(emailarry); //複数ユーザー登録時、配列を渡す
protect.setDomainEdit(true); //GWでドメインユーザーを許可する場合
const book = SpreadsheetApp.getActiveSpreadsheet();
const sheet = book.getActiveSheet();
const pType = SpreadsheetApp.ProtectionType;
const protect = sheet.getProtections(pType.RANGE);
for(let i=0; i<protect.length; i++){
protect[i].remove();
}
//行、列のスタート位置の取得
const sRow = protect[i].getRange().getRow();
const sCol = protect[i].getRange().getColumn();
//行、列の最終位置を取得したい時
const eRow = protect[i].getRange().getLastRow();
const eCol = protect[i].getRange().getLastColumn();
//行、列の範囲数を取得したい場合
const rRow = protect[i].getRange().getNumRows();
const rCol = protect[i].getRange().getNumColmuns();