Class Protection

সুরক্ষা

সুরক্ষিত রেঞ্জ এবং শীটগুলি অ্যাক্সেস এবং সংশোধন করুন৷ একটি সুরক্ষিত পরিসর কোষের একটি স্থির পরিসর বা একটি নামকৃত পরিসর রক্ষা করতে পারে। একটি সুরক্ষিত শীটে অরক্ষিত অঞ্চল অন্তর্ভুক্ত থাকতে পারে। Google পত্রকের পুরানো সংস্করণ দিয়ে তৈরি স্প্রেডশীটের জন্য, পরিবর্তে PageProtection ক্লাস ব্যবহার করুন৷

// Protect range A1:B10, then remove all other users from the list of editors.
var ss = SpreadsheetApp.getActive();
var range = ss.getRange('A1:B10');
var protection = range.protect().setDescription('Sample protected range');

// Ensure the current user is an editor before removing others. Otherwise, if the user's edit
// permission comes from a group, the script throws an exception upon removing the group.
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
  protection.setDomainEdit(false);
}
// Remove all range protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}
// Protect the active sheet, then remove all other users from the list of editors.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.protect().setDescription('Sample protected sheet');

// Ensure the current user is an editor before removing others. Otherwise, if the user's edit
// permission comes from a group, the script throws an exception upon removing the group.
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
  protection.setDomainEdit(false);
}

পদ্ধতি

পদ্ধতি রিটার্ন টাইপ সংক্ষিপ্ত বর্ণনা
addEditor(emailAddress) Protection প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় যুক্ত করে।
addEditor(user) Protection প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় যুক্ত করে।
addEditors(emailAddresses) Protection সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় ব্যবহারকারীদের প্রদত্ত অ্যারে যুক্ত করে।
addTargetAudience(audienceId) Protection সুরক্ষিত পরিসরের সম্পাদক হিসাবে নির্দিষ্ট লক্ষ্য দর্শকদের যোগ করে।
canDomainEdit() Boolean স্প্রেডশীটের মালিক ডোমেনের সমস্ত ব্যবহারকারীদের সুরক্ষিত পরিসর বা পত্রক সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে৷
canEdit() Boolean ব্যবহারকারীর সুরক্ষিত পরিসর বা পত্রক সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে।
getDescription() String সুরক্ষিত পরিসর বা পত্রকের বিবরণ পায়।
getEditors() User[] সুরক্ষিত পরিসর বা পত্রকের জন্য সম্পাদকদের তালিকা পায়।
getProtectionType() ProtectionType সুরক্ষিত এলাকার ধরন পায়, হয় RANGE বা SHEET
getRange() Range সুরক্ষিত করা হচ্ছে যে পরিসীমা পায়.
getRangeName() String সুরক্ষিত পরিসরের নাম পায় যদি এটি একটি নামযুক্ত পরিসরের সাথে যুক্ত হয়।
getTargetAudiences() TargetAudience[] সুরক্ষিত পরিসর সম্পাদনা করতে পারে এমন লক্ষ্য দর্শকদের আইডি ফেরত দেয়।
getUnprotectedRanges() Range[] একটি সুরক্ষিত পত্রকের মধ্যে অরক্ষিত রেঞ্জের একটি অ্যারে পায়৷
isWarningOnly() Boolean সুরক্ষিত এলাকা "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা নির্ধারণ করে।
remove() void পরিসর বা শীটকে অরক্ষিত করে।
removeEditor(emailAddress) Protection প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকা থেকে সরিয়ে দেয়।
removeEditor(user) Protection প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকা থেকে সরিয়ে দেয়।
removeEditors(emailAddresses) Protection সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকা থেকে ব্যবহারকারীদের প্রদত্ত অ্যারে সরিয়ে দেয়।
removeTargetAudience(audienceId) Protection সুরক্ষিত পরিসরের সম্পাদক হিসাবে নির্দিষ্ট লক্ষ্য দর্শকদের সরিয়ে দেয়।
setDescription(description) Protection সুরক্ষিত পরিসর বা পত্রকের বিবরণ সেট করে।
setDomainEdit(editable) Protection স্প্রেডশীটের মালিক ডোমেনের সমস্ত ব্যবহারকারীদের সুরক্ষিত পরিসর বা পত্রক সম্পাদনা করার অনুমতি আছে কিনা তা সেট করে৷
setNamedRange(namedRange) Protection একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সুরক্ষিত পরিসরকে সংযুক্ত করে।
setRange(range) Protection যে পরিসীমা সুরক্ষিত হচ্ছে তা সামঞ্জস্য করে।
setRangeName(rangeName) Protection একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সুরক্ষিত পরিসরকে সংযুক্ত করে।
setUnprotectedRanges(ranges) Protection একটি সুরক্ষিত পত্রকের মধ্যে প্রদত্ত ব্যাপ্তিগুলিকে অরক্ষিত করে।
setWarningOnly(warningOnly) Protection এই সুরক্ষিত পরিসর "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা সেট করে।

বিস্তারিত ডকুমেন্টেশন

addEditor(emailAddress)

প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় যুক্ত করে। এই পদ্ধতিটি স্বয়ংক্রিয়ভাবে ব্যবহারকারীকে স্প্রেডশীট সম্পাদনা করার অনুমতি দেয় না; এটি করার জন্য, Spreadsheet.addEditor(emailAddress) কল করুন।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Adds an editor to the spreadsheet using an email address.
// TODO(developer): Replace the email address with a valid email.
ss.addEditor('cloudysanfrancisco@gmail.com');

// Gets a sheet by its name and protects it.
const sheet = ss.getSheetByName('Sheet1');
const sampleProtectedSheet = sheet.protect();

// Adds an editor of the protected sheet using an email address.
// TODO(developer): Replace the email address with a valid email.
sampleProtectedSheet.addEditor('cloudysanfrancisco@gmail.com');

// Gets the editors of the protected sheet.
const editors = sampleProtectedSheet.getEditors();

// Logs the editors' email addresses to the console.
for (const editor of editors) {
  console.log(editor.getEmail());
}

পরামিতি

নাম টাইপ বর্ণনা
emailAddress String ব্যবহারকারীর ইমেইল ঠিকানা যোগ করতে হবে।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addEditor(user)

প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় যুক্ত করে। এই পদ্ধতিটি স্বয়ংক্রিয়ভাবে ব্যবহারকারীকে স্প্রেডশীট সম্পাদনা করার অনুমতি দেয় না; এটি করার জন্য, Spreadsheet.addEditor(user) কল করুন।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Adds the active user as an editor of the protected sheet.
sampleProtectedSheet.addEditor(Session.getActiveUser());

// Gets the editors of the protected sheet.
const editors = sampleProtectedSheet.getEditors();

// Logs the editors' email addresses to the console.
for (const editor of editors) {
  console.log(editor.getEmail());
}

পরামিতি

নাম টাইপ বর্ণনা
user User যোগ করার জন্য ব্যবহারকারীর একটি উপস্থাপনা।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addEditors(emailAddresses)

সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় ব্যবহারকারীদের প্রদত্ত অ্যারে যুক্ত করে। এই পদ্ধতি স্বয়ংক্রিয়ভাবে ব্যবহারকারীদের স্প্রেডশীট সম্পাদনা করার অনুমতি দেয় না; এটি করার জন্য, Spreadsheet.addEditors(emailAddresses) কল করুন।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Creates variables for the email addresses to add as editors.
// TODO(developer): Replace the email addresses with valid ones.
const TEST_EMAIL_1 = 'cloudysanfrancisco@gmail.com';
const TEST_EMAIL_2 = 'baklavainthebalkans@gmail.com';

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Adds editors to the protected sheet using the email address variables.
sampleProtectedSheet.addEditors([TEST_EMAIL_1, TEST_EMAIL_2]);

// Gets the editors of the protected sheet.
const editors = sampleProtectedSheet.getEditors();

// Logs the editors' email addresses to the console.
for (const editor of editors) {
  console.log(editor.getEmail());
}

পরামিতি

নাম টাইপ বর্ণনা
emailAddresses String[] ব্যবহারকারীদের ইমেল ঠিকানা যোগ করার জন্য একটি অ্যারে.

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

addTargetAudience(audienceId)

সুরক্ষিত পরিসরের সম্পাদক হিসাবে নির্দিষ্ট লক্ষ্য দর্শকদের যোগ করে।

পরামিতি

নাম টাইপ বর্ণনা
audienceId String টার্গেট অডিয়েন্সের আইডি যোগ করতে হবে।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

canDomainEdit()

স্প্রেডশীটের মালিক ডোমেনের সমস্ত ব্যবহারকারীদের সুরক্ষিত পরিসর বা পত্রক সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে৷ ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি না থাকলে একটি ব্যতিক্রম নিক্ষেপ করে৷

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Logs whether domain users have permission to edit the protected sheet to the console.
console.log(sampleProtectedSheet.canDomainEdit());

প্রত্যাবর্তন

Booleantrue যদি স্প্রেডশীটের মালিক ডোমেনের সমস্ত ব্যবহারকারীদের সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি থাকে; false যদি তারা না করে।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

canEdit()

ব্যবহারকারীর সুরক্ষিত পরিসর বা পত্রক সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে। স্প্রেডশীটের মালিক সর্বদা সুরক্ষিত রেঞ্জ এবং শীট সম্পাদনা করতে সক্ষম।

// Remove all range protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}

প্রত্যাবর্তন

Booleantrue যদি ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি থাকে; false না হলে

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getDescription()

সুরক্ষিত পরিসর বা পত্রকের বিবরণ পায়। যদি কোন বিবরণ সেট করা না থাকে, এই পদ্ধতিটি একটি খালি স্ট্রিং প্রদান করে।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet and sets the description.
const sampleProtectedSheet = sheet.protect().setDescription('Sample sheet is protected');

// Gets the description of the protected sheet and logs it to the console.
const sampleProtectedSheetDescription = sampleProtectedSheet.getDescription();
console.log(sampleProtectedSheetDescription);

প্রত্যাবর্তন

String — সুরক্ষিত পরিসর বা শীটের বিবরণ, অথবা কোনো বিবরণ সেট না থাকলে একটি খালি স্ট্রিং।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getEditors()

সুরক্ষিত পরিসর বা পত্রকের জন্য সম্পাদকদের তালিকা পায়। ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি না থাকলে একটি ব্যতিক্রম নিক্ষেপ করে৷

// Protect the active sheet, then remove all other users from the list of editors.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.protect().setDescription('Sample protected sheet');

// Ensure the current user is an editor before removing others. Otherwise, if the user's edit
// permission comes from a group, the script throws an exception upon removing the group.
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
  protection.setDomainEdit(false);
}

প্রত্যাবর্তন

User[] — সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি সহ ব্যবহারকারীদের একটি অ্যারে

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getProtectionType()

সুরক্ষিত এলাকার ধরন পায়, হয় RANGE বা SHEET

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Gets the type of the protected area.
const protectionType = sampleProtectedSheet.getProtectionType();

// Logs 'SHEET'to the console since the type of the protected area is a sheet.
console.log(protectionType.toString());

প্রত্যাবর্তন

ProtectionType — সুরক্ষিত এলাকার ধরন, হয় RANGE বা SHEET

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRange()

সুরক্ষিত করা হচ্ছে যে পরিসীমা পায়. যদি সুরক্ষা একটি পরিসরের পরিবর্তে শীটে প্রযোজ্য হয়, তাহলে এই পদ্ধতিটি একটি পরিসর প্রদান করে যা পুরো শীটকে বিস্তৃত করে।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Gets the range 'A1:B10' of Sheet1.
const range = sheet.getRange('A1:B10');

// Makes cells A1:B10 a protected range.
const sampleProtectedRange = range.protect();

// Gets the protected ranges on the sheet.
const protections = sheet.getProtections(SpreadsheetApp.ProtectionType.RANGE);

// Logs the A1 notation of the first protected range on the sheet.
console.log(protections[0].getRange().getA1Notation());

প্রত্যাবর্তন

Range — যে পরিসীমা সুরক্ষিত হচ্ছে।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getRangeName()

সুরক্ষিত পরিসরের নাম পায় যদি এটি একটি নামযুক্ত পরিসরের সাথে যুক্ত হয়। যদি সুরক্ষা একটি নামযুক্ত পরিসরের সাথে যুক্ত না হয় তাহলে null প্রদান করে। দ্রষ্টব্য যে স্ক্রিপ্টগুলিকে স্পষ্টভাবে একটি নামযুক্ত পরিসরের সাথে একটি সুরক্ষিত পরিসর সংযুক্ত করতে setRangeName(rangeName) কল করতে হবে; একটি Range থেকে একটি সুরক্ষা তৈরি করতে Range.protect() কল করা যা একটি নামকৃত পরিসর হতে পারে, setRangeName(rangeName) কল না করে, তাদের সংযুক্ত করার জন্য যথেষ্ট নয়। যাইহোক, Google পত্রক UI-তে একটি নামযুক্ত পরিসর থেকে একটি সুরক্ষিত পরিসর তৈরি করা তাদের স্বয়ংক্রিয়ভাবে সংযুক্ত করে।

// Protect a named range in a spreadsheet and log the name of the protected range.
var ss = SpreadsheetApp.getActive();
var range = ss.getRange('A1:B10');
var protection = range.protect();
ss.setNamedRange('Test', range);       // Create a named range.
protection.setRangeName('Test');       // Associate the protection with the named range.
Logger.log(protection.getRangeName()); // Verify the name of the protected range.

প্রত্যাবর্তন

String — সুরক্ষিত নামকৃত পরিসরের নাম, বা null যদি সুরক্ষিত পরিসর কোনো নামকৃত পরিসরের সাথে যুক্ত না হয়

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getTargetAudiences()

সুরক্ষিত পরিসর সম্পাদনা করতে পারে এমন লক্ষ্য দর্শকদের আইডি ফেরত দেয়।

প্রত্যাবর্তন

TargetAudience[] — টার্গেট অডিয়েন্সের আইডির একটি অ্যারে।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getUnprotectedRanges()

একটি সুরক্ষিত পত্রকের মধ্যে অরক্ষিত রেঞ্জের একটি অ্যারে পায়৷ যদি Protection বস্তুটি সুরক্ষিত শীটের পরিবর্তে একটি সুরক্ষিত পরিসরের সাথে মিলে যায় তবে এই পদ্ধতিটি একটি খালি অ্যারে প্রদান করে। অরক্ষিত রেঞ্জগুলি পরিবর্তন করতে, ব্যাপ্তির একটি নতুন অ্যারে সেট করতে setUnprotectedRanges(ranges) ব্যবহার করুন; সম্পূর্ণ শীট পুনরায় সুরক্ষিত করতে, একটি খালি অ্যারে সেট করুন।

// Unprotect cells E2:F5 in addition to any other unprotected ranges in the protected sheet.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.protect();
var unprotected = protection.getUnprotectedRanges();
unprotected.push(sheet.getRange('E2:F5'));
protection.setUnprotectedRanges(unprotected);

প্রত্যাবর্তন

Range[] — একটি সুরক্ষিত শীটের মধ্যে অরক্ষিত রেঞ্জের একটি অ্যারে

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

isWarningOnly()

সুরক্ষিত এলাকা "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা নির্ধারণ করে। সতর্কতা-ভিত্তিক সুরক্ষার অর্থ হল যে প্রত্যেক ব্যবহারকারী এই এলাকায় ডেটা সম্পাদনা করতে পারে, সম্পাদনা করা ব্যবহারকারীকে সম্পাদনা নিশ্চিত করতে অনুরোধ করে একটি সতর্কতা প্রম্পট ছাড়া। ডিফল্টরূপে, সুরক্ষিত রেঞ্জ বা শীট সতর্কতা ভিত্তিক নয়। সতর্কতা অবস্থায় পরিবর্তন করতে, setWarningOnly(warningOnly) ব্যবহার করুন।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit')

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Sets the warning status for the protected sheet as true.
sampleProtectedSheet.setWarningOnly(true);

const protectedSheetWarningStatus = sampleProtectedSheet.isWarningOnly();

// Logs the warning status of the protected sheet to the console.
console.log(protectedSheetWarningStatus);

প্রত্যাবর্তন

Booleantrue যদি সুরক্ষিত পরিসর বা শীট শুধুমাত্র সতর্কতা-ভিত্তিক সুরক্ষা ব্যবহার করে।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

remove()

পরিসর বা শীটকে অরক্ষিত করে।

// Remove all range protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}
// Remove sheet protection from the active sheet, if the user has permission to edit it.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
if (protection && protection.canEdit()) {
  protection.remove();
}

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeEditor(emailAddress)

প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকা থেকে সরিয়ে দেয়। মনে রাখবেন যে ব্যবহারকারী যদি এমন একটি Google গোষ্ঠীর সদস্য হন যার সম্পাদনার অনুমতি রয়েছে, বা যদি ডোমেনের সমস্ত ব্যবহারকারীর সম্পাদনার অনুমতি থাকে, তবে ব্যবহারকারী এখনও সুরক্ষিত এলাকা সম্পাদনা করতে সক্ষম হবেন। স্প্রেডশীটের মালিক বা বর্তমান ব্যবহারকারীকেও সরানো যাবে না।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Creates a variable for an email address.
// TODO(developer): Replace the email address with a valid one.
const TEST_EMAIL = 'baklavainthebalkans@gmail.com';

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Adds an editor to the protected sheet using the email address variable.
sampleProtectedSheet.addEditor(TEST_EMAIL);

// Removes the editor from the protected sheet using the email address variable.
sampleProtectedSheet.removeEditor(TEST_EMAIL);

// Gets the editors of the protected sheet.
const editors = sampleProtectedSheet.getEditors();

// Logs the editors' email addresses to the console.
for (const editor of editors) {
  console.log(editor.getEmail());
}

পরামিতি

নাম টাইপ বর্ণনা
emailAddress String ব্যবহারকারীর ইমেইল ঠিকানা অপসারণ.

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeEditor(user)

প্রদত্ত ব্যবহারকারীকে সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকা থেকে সরিয়ে দেয়। মনে রাখবেন যে ব্যবহারকারী যদি এমন একটি Google গোষ্ঠীর সদস্য হন যার সম্পাদনার অনুমতি রয়েছে, বা যদি ডোমেনের সমস্ত ব্যবহারকারীর সম্পাদনার অনুমতি থাকে, তবে ব্যবহারকারী এখনও সুরক্ষিত এলাকাটি সম্পাদনা করতে সক্ষম হবেন। স্প্রেডশীটের মালিক বা বর্তমান ব্যবহারকারীকেও সরানো যাবে না।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets a sheet by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Removes the active user from the editors of the protected sheet.
sampleProtectedSheet.removeEditor(Session.getActiveUser());

// Gets the editors of the protected sheet.
const editors = sampleProtectedSheet.getEditors();

// Logs the editors' email addresses to the console.
for (const editor of editors) {
  console.log(editor.getEmail());
}

পরামিতি

নাম টাইপ বর্ণনা
user User সরানোর জন্য ব্যবহারকারীর একটি প্রতিনিধিত্ব.

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeEditors(emailAddresses)

সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকা থেকে ব্যবহারকারীদের প্রদত্ত অ্যারে সরিয়ে দেয়। মনে রাখবেন যে ব্যবহারকারীদের মধ্যে কেউ যদি এমন একটি Google গোষ্ঠীর সদস্য হন যার সম্পাদনার অনুমতি রয়েছে, বা যদি ডোমেনের সমস্ত ব্যবহারকারীর সম্পাদনার অনুমতি থাকে, তবে সেই ব্যবহারকারীরা এখনও সুরক্ষিত এলাকা সম্পাদনা করতে সক্ষম হবেন। স্প্রেডশীটের মালিক বা বর্তমান ব্যবহারকারীকেও সরানো যাবে না।

// Protect the active sheet, then remove all other users from the list of editors.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.protect().setDescription('Sample protected sheet');

// Ensure the current user is an editor before removing others. Otherwise, if the user's edit
// permission comes from a group, the script throws an exception upon removing the group.
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
  protection.setDomainEdit(false);
}

পরামিতি

নাম টাইপ বর্ণনা
emailAddresses String[] ব্যবহারকারীদের ইমেল ঠিকানা একটি অ্যারে অপসারণ.

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

removeTargetAudience(audienceId)

সুরক্ষিত পরিসরের সম্পাদক হিসাবে নির্দিষ্ট লক্ষ্য দর্শকদের সরিয়ে দেয়।

পরামিতি

নাম টাইপ বর্ণনা
audienceId String টার্গেট অডিয়েন্সের আইডি রিমুভ করতে হবে।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setDescription(description)

সুরক্ষিত পরিসর বা পত্রকের বিবরণ সেট করে।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets the sheet 'Sheet1' by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet.
const sampleProtectedSheet = sheet.protect();

// Sets the sheet description to 'Sheet1 is protected.'
sampleProtectedSheet.setDescription('Sheet1 is protected');

// Gets the description of the protected sheet.
const sampleProtectedSheetDescription = sampleProtectedSheet.getDescription();

// Logs the description of the protected sheet to the console.
console.log(sampleProtectedSheetDescription);

পরামিতি

নাম টাইপ বর্ণনা
description String সুরক্ষিত পরিসর বা পত্রকের বিবরণ।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setDomainEdit(editable)

স্প্রেডশীটের মালিক ডোমেনের সমস্ত ব্যবহারকারীদের সুরক্ষিত পরিসর বা পত্রক সম্পাদনা করার অনুমতি আছে কিনা তা সেট করে৷ নোট করুন যে কোনো ব্যবহারকারী যাদের স্পষ্ট সম্পাদনার অনুমতি আছে তারা এই সেটিং নির্বিশেষে সুরক্ষিত এলাকা সম্পাদনা করতে সক্ষম। যদি স্প্রেডশীটটি Google Workspace ডোমেনের (অর্থাৎ, এটি একটি gmail.com অ্যাকাউন্টের মালিকানাধীন হয়) এর অন্তর্গত না হয় তবে একটি ব্যতিক্রম থ্রো করে।

পরামিতি

নাম টাইপ বর্ণনা
editable Boolean true যদি স্প্রেডশীটের মালিক ডোমেনের সমস্ত ব্যবহারকারীদের সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি থাকা উচিত; false না হলে।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setNamedRange(namedRange)

একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সুরক্ষিত পরিসরকে সংযুক্ত করে। যদি নামকৃত পরিসর বর্তমান সুরক্ষিত পরিসর থেকে একটি ভিন্ন এলাকা কভার করে, তবে এই পদ্ধতিটি পরিবর্তে নামযুক্ত পরিসর কভার করার জন্য সুরক্ষা স্থানান্তরিত করে। বর্তমান সুরক্ষিত পরিসরের মতো একই শীটে নাম দেওয়া ব্যাপ্তি অবশ্যই থাকতে হবে। মনে রাখবেন যে স্ক্রিপ্টগুলিকে স্পষ্টভাবে এই পদ্ধতিটিকে একটি সুরক্ষিত পরিসরকে একটি নামযুক্ত পরিসরের সাথে সংযুক্ত করতে কল করতে হবে; একটি Range থেকে একটি সুরক্ষা তৈরি করতে Range.protect() কল করা যা একটি নামকৃত পরিসর হতে পারে, setRangeName(rangeName) কল না করে, তাদের সংযুক্ত করার জন্য যথেষ্ট নয়। যাইহোক, Google পত্রক UI-তে একটি নামযুক্ত পরিসর থেকে একটি সুরক্ষিত পরিসর তৈরি করা তাদের স্বয়ংক্রিয়ভাবে সংযুক্ত করে।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Protects cells A1:D10 on Sheet1.
const sheet = ss.getSheetByName('Sheet1');
const protectedRange = sheet.getRange('A1:D10').protect();

// Logs the current protected range, A1:D10.
console.log(protectedRange.getRange().getA1Notation());

// Creates a named range for cells E1:J10 called 'NewRange.'
const newRange = sheet.getRange('E1:J10');
ss.setNamedRange('NewRange', newRange);
const namedRange = ss.getNamedRanges()[0];

// Updates the protected range to the named range, 'NewRange.'
// This updates the protected range on Sheet1 from A1:D10 to E1:J10.
protectedRange.setNamedRange(namedRange);

// Logs the updated protected range to the console.
console.log(protectedRange.getRange().getA1Notation());

পরামিতি

নাম টাইপ বর্ণনা
namedRange NamedRange সংরক্ষিত ব্যাপ্তির সাথে সংযুক্ত করার জন্য বিদ্যমান নামকৃত ব্যাপ্তি।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setRange(range)

যে পরিসীমা সুরক্ষিত হচ্ছে তা সামঞ্জস্য করে। যদি প্রদত্ত পরিসর বর্তমান সুরক্ষিত পরিসর থেকে একটি ভিন্ন এলাকা কভার করে, তবে এই পদ্ধতিটি পরিবর্তে নতুন পরিসর কভার করার জন্য সুরক্ষাকে সরিয়ে দেয়।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Protects cells A1:D10 on Sheet1 of the spreadsheet.
const sheet = ss.getSheetByName('Sheet1');
const protectedRange = sheet.getRange('A1:D10').protect();

// Logs the original protected range, A1:D10, to the console.
console.log(protectedRange.getRange().getA1Notation());

// Gets the range E1:J10.
const newRange = sheet.getRange('E1:J10');

// Updates the protected range to E1:J10.
protectedRange.setRange(newRange);

// Logs the updated protected range to the console.
console.log(protectedRange.getRange().getA1Notation());

পরামিতি

নাম টাইপ বর্ণনা
range Range সম্পাদনা থেকে রক্ষা করার জন্য নতুন পরিসর।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setRangeName(rangeName)

একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সুরক্ষিত পরিসরকে সংযুক্ত করে। যদি নামকৃত পরিসর বর্তমান সুরক্ষিত পরিসর থেকে একটি ভিন্ন এলাকা কভার করে, তবে এই পদ্ধতিটি পরিবর্তে নামযুক্ত পরিসর কভার করার জন্য সুরক্ষা স্থানান্তরিত করে। বর্তমান সুরক্ষিত পরিসরের মতো একই শীটে নাম দেওয়া ব্যাপ্তি অবশ্যই থাকতে হবে। মনে রাখবেন যে স্ক্রিপ্টগুলিকে স্পষ্টভাবে এই পদ্ধতিটিকে একটি সুরক্ষিত পরিসরকে একটি নামযুক্ত পরিসরের সাথে সংযুক্ত করতে কল করতে হবে; একটি Range থেকে একটি সুরক্ষা তৈরি করতে Range.protect() কল করা যা একটি নামকৃত পরিসর হতে পারে, setRangeName(rangeName) কল না করে, তাদের সংযুক্ত করার জন্য যথেষ্ট নয়। যাইহোক, Google পত্রক UI-তে একটি নামযুক্ত পরিসর থেকে একটি সুরক্ষিত পরিসর তৈরি করা তাদের স্বয়ংক্রিয়ভাবে সংযুক্ত করে।

// Protect a named range in a spreadsheet and log the name of the protected range.
var ss = SpreadsheetApp.getActive();
var range = ss.getRange('A1:B10');
var protection = range.protect();
ss.setNamedRange('Test', range);       // Create a named range.
protection.setRangeName('Test');       // Associate the protection with the named range.
Logger.log(protection.getRangeName()); // Verify the name of the protected range.

পরামিতি

নাম টাইপ বর্ণনা
rangeName String নামকৃত রেঞ্জের নাম সুরক্ষিত করতে হবে।

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setUnprotectedRanges(ranges)

একটি সুরক্ষিত পত্রকের মধ্যে প্রদত্ত ব্যাপ্তিগুলিকে অরক্ষিত করে। একটি ব্যতিক্রম নিক্ষেপ করে যদি Protection বস্তুটি সুরক্ষিত শীটের পরিবর্তে একটি সুরক্ষিত পরিসরের সাথে মিলে যায় বা যদি কোনো রেঞ্জ সুরক্ষিত শীটে না থাকে। অরক্ষিত রেঞ্জ পরিবর্তন করতে, রেঞ্জের একটি নতুন অ্যারে সেট করুন; সম্পূর্ণ শীট পুনরায় সুরক্ষিত করতে, একটি খালি অ্যারে সেট করুন।

// Protect the active sheet except B2:C5, then remove all other users from the list of editors.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.protect().setDescription('Sample protected sheet');
var unprotected = sheet.getRange('B2:C5');
protection.setUnprotectedRanges([unprotected]);

// Ensure the current user is an editor before removing others. Otherwise, if the user's edit
// permission comes from a group, the script throws an exception upon removing the group.
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
  protection.setDomainEdit(false);
}

পরামিতি

নাম টাইপ বর্ণনা
ranges Range[] একটি সুরক্ষিত পত্রকের মধ্যে অরক্ষিত রাখার জন্য ব্যাপ্তির বিন্যাস৷

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setWarningOnly(warningOnly)

এই সুরক্ষিত পরিসর "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা সেট করে। সতর্কতা-ভিত্তিক সুরক্ষার অর্থ হল যে প্রত্যেক ব্যবহারকারী এই এলাকায় ডেটা সম্পাদনা করতে পারে, সম্পাদনা করা ব্যবহারকারীকে সম্পাদনা নিশ্চিত করতে অনুরোধ করে একটি সতর্কতা প্রম্পট ছাড়া। ডিফল্টরূপে, সুরক্ষিত রেঞ্জ বা শীট সতর্কতা ভিত্তিক নয়। সতর্কতা অবস্থা পরীক্ষা করতে, isWarningOnly() ব্যবহার করুন।

// Opens the spreadsheet file by its URL. If you created your script from within
// a Google Sheets file, you can use SpreadsheetApp.getActiveSpreadsheet() instead.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Gets the sheet 'Sheet1' by its name.
const sheet = ss.getSheetByName('Sheet1');

// Protects the sheet and sets the protection to warning-based.
const sampleProtectedSheet = sheet.protect().setWarningOnly(true);

// Logs whether the protected sheet is warning-based to the console.
console.log(sampleProtectedSheet.isWarningOnly());

পরামিতি

নাম টাইপ বর্ণনা
warningOnly Boolean

প্রত্যাবর্তন

Protection - চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets