การแจงนับซึ่งแสดงส่วนต่างๆ ของสเปรดชีตที่ป้องกันการแก้ไขได้
หากต้องการเรียก enum คุณจะต้องเรียกคลาส ชื่อ และพร็อพเพอร์ตี้ระดับบนสุด เช่น
SpreadsheetApp.ProtectionType.RANGE
// Remove all range protections in the spreadsheet that the user has permission // to edit. const ss = SpreadsheetApp.getActive(); const protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE); for (const protection of protections) { if (protection.canEdit()) { protection.remove(); } }
// Removes sheet protection from the active sheet, if the user has permission to // edit it. const sheet = SpreadsheetApp.getActiveSheet(); const protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0]; if (protection?.canEdit()) { protection.remove(); }
พร็อพเพอร์ตี้
| พร็อพเพอร์ตี้ | ประเภท | คำอธิบาย |
|---|---|---|
RANGE | Enum | การป้องกันสำหรับช่วง |
SHEET | Enum | การป้องกันชีต |