Class PageProtection

페이지보호

지원 중단되었습니다. 최신 버전의 Google Sheets에서 만든 스프레드시트의 경우 더 강력한 Protection 클래스를 대신 사용하세요. 이 클래스는 지원 중단되었지만 이전 버전의 Sheets와의 호환성을 위해 계속 사용할 수 있습니다.

이전 버전의 Google Sheets에서 보호된 시트에 액세스하고 수정합니다.

메서드반환 유형간략한 설명
addUser(email)void시트가 보호된 경우 시트를 수정할 수 있는 사용자 목록에 사용자를 추가합니다.
getUsers()String[]이 시트를 수정할 수 있는 사용자의 이메일 주소 목록을 반환합니다.
isProtected()Boolean시트에 시트 보호가 사용 설정되어 있는지 여부를 나타냅니다.
removeUser(user)void시트를 수정할 수 있는 사용자 목록에서 사용자를 삭제합니다.
setProtected(protection)void시트의 보호 상태를 설정합니다.

지원 중단된 메서드

지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.

시트가 보호된 경우 시트를 수정할 수 있는 사용자 목록에 사용자를 추가합니다.

// Add the "user@example.com" user to the list of users who can edit this sheet
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
permissions.addUser('user@example.com');
permissions.setProtected(true);
sheet.setSheetProtection(permissions);

매개변수

이름유형설명
emailString추가할 사용자의 이메일입니다.

참고 항목


지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.

이 시트를 수정할 수 있는 사용자의 이메일 주소 목록을 반환합니다.

시트 보호가 사용 중지된 경우 이 호출에서 반환된 값은 의미가 없습니다.

리턴

String[]: 이 시트를 수정할 수 있는 사용자의 이메일 주소 배열


지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.

시트에 시트 보호가 사용 설정되어 있는지 여부를 나타냅니다.

// Determine whether or not sheet protection is enabled
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
const isProtected = permissions.isProtected();

리턴

Boolean: 시트에 시트 보호가 사용 설정되어 있는지 여부

참고 항목


지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.

시트를 수정할 수 있는 사용자 목록에서 사용자를 삭제합니다.

// Remove the "user@example.com" user to the list of users who can edit this
// sheet
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
permissions.removeUser('user@example.com');
permissions.setProtected(true);
sheet.setSheetProtection(permissions);

매개변수

이름유형설명
userString삭제할 사용자의 이메일 주소입니다.

참고 항목


지원 중단되었습니다. 이 함수는 지원 중단되었으며 새 스크립트에서 사용해서는 안 됩니다.

시트의 보호 상태를 설정합니다.

// Enables sheet protection for  this sheet
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
permissions.setProtected(true);
sheet.setSheetProtection(permissions);

매개변수

이름유형설명
protectionBooleantrue: 시트 보호를 사용 설정하고 false: 시트 보호를 사용 중지합니다.

참고 항목