সুরক্ষিত রেঞ্জ এবং শিট অ্যাক্সেস এবং সংশোধন করুন। একটি সুরক্ষিত রেঞ্জ কোষের একটি স্ট্যাটিক রেঞ্জ অথবা একটি নামযুক্ত রেঞ্জকে সুরক্ষিত করতে পারে। একটি সুরক্ষিত শিটে অরক্ষিত অঞ্চল অন্তর্ভুক্ত থাকতে পারে। Google Sheets-এর পুরোনো সংস্করণ দিয়ে তৈরি স্প্রেডশিটের জন্য, পরিবর্তে ক্লাস ব্যবহার করুন।Page Protection
// Protect range A1:B10, then remove all other users from the list of editors. const ss = SpreadsheetApp.getActive(); const range = ss.getRange('A1:B10'); const 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. const 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. const ss = SpreadsheetApp.getActive(); const protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE); for (let i = 0; i < protections.length; i++) { const protection = protections[i]; if (protection.canEdit()) { protection.remove(); } }
// Protect the active sheet, then remove all other users from the list of // editors. const sheet = SpreadsheetApp.getActiveSheet(); const 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. const me = Session.getEffectiveUser(); protection.addEditor(me); protection.removeEditors(protection.getEditors()); if (protection.canDomainEdit()) { protection.setDomainEdit(false); }
পদ্ধতি
| পদ্ধতি | রিটার্ন টাইপ | সংক্ষিপ্ত বিবরণ |
|---|---|---|
add Editor(emailAddress) | Protection | সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় প্রদত্ত ব্যবহারকারীকে যুক্ত করে। |
add Editor(user) | Protection | সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় প্রদত্ত ব্যবহারকারীকে যুক্ত করে। |
add Editors(emailAddresses) | Protection | সুরক্ষিত শীট বা পরিসরের জন্য সম্পাদকদের তালিকায় ব্যবহারকারীদের প্রদত্ত অ্যারে যোগ করে। |
add Target Audience(audienceId) | Protection | সুরক্ষিত পরিসরের সম্পাদক হিসেবে নির্দিষ্ট লক্ষ্য দর্শকদের যোগ করে। |
can Domain Edit() | Boolean | স্প্রেডশিটের মালিকানাধীন ডোমেনের সমস্ত ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে। |
can Edit() | Boolean | ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে। |
get Description() | String | সুরক্ষিত পরিসর বা শীটের বিবরণ পায়। |
get Editors() | User[] | সুরক্ষিত পরিসর বা শীটের জন্য সম্পাদকদের তালিকা পায়। |
get Protection Type() | Protection Type | সুরক্ষিত এলাকার ধরণ পায়, হয় RANGE অথবা SHEET । |
get Range() | Range | সুরক্ষিত পরিসর পায়। |
get Range Name() | String|null | সুরক্ষিত পরিসরের নাম পায় যদি এটি একটি নামযুক্ত পরিসরের সাথে সম্পর্কিত হয়। |
get Target Audiences() | Target Audience[] | সুরক্ষিত পরিসর সম্পাদনা করতে পারে এমন লক্ষ্য দর্শকদের আইডি ফেরত পাঠায়। |
get Unprotected Ranges() | Range[] | একটি সুরক্ষিত শীটের মধ্যে অরক্ষিত পরিসরের একটি অ্যারে পায়। |
is Warning Only() | Boolean | সুরক্ষিত এলাকাটি "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা নির্ধারণ করে। |
remove() | void | পরিসর বা শীটকে অরক্ষিত করে। |
remove Editor(emailAddress) | Protection | সুরক্ষিত শীট বা ব্যাপ্তির জন্য সম্পাদকদের তালিকা থেকে প্রদত্ত ব্যবহারকারীকে সরিয়ে দেয়। |
remove Editor(user) | Protection | সুরক্ষিত শীট বা ব্যাপ্তির জন্য সম্পাদকদের তালিকা থেকে প্রদত্ত ব্যবহারকারীকে সরিয়ে দেয়। |
remove Editors(emailAddresses) | Protection | সুরক্ষিত শীট বা ব্যাপ্তির জন্য সম্পাদকদের তালিকা থেকে ব্যবহারকারীদের প্রদত্ত অ্যারে সরিয়ে দেয়। |
remove Target Audience(audienceId) | Protection | সুরক্ষিত পরিসরের সম্পাদক হিসেবে নির্দিষ্ট লক্ষ্য দর্শকদের সরিয়ে দেয়। |
set Description(description) | Protection | সুরক্ষিত পরিসর বা শীটের বর্ণনা সেট করে। |
set Domain Edit(editable) | Protection | স্প্রেডশিটের মালিকানাধীন ডোমেনের সকল ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি আছে কিনা তা সেট করে। |
set Named Range(namedRange) | Protection | সুরক্ষিত পরিসরটিকে একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সংযুক্ত করে। |
set Range(range) | Protection | সুরক্ষিত পরিসর সামঞ্জস্য করে। |
set Range Name(rangeName) | Protection | সুরক্ষিত পরিসরটিকে একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সংযুক্ত করে। |
set Unprotected Ranges(ranges) | Protection | একটি সুরক্ষিত শীটের মধ্যে প্রদত্ত ব্যাপ্তির অ্যারেটিকে অরক্ষিত করে। |
set Warning Only(warningOnly) | Protection | এই সুরক্ষিত পরিসরটি "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা সেট করে। |
বিস্তারিত ডকুমেন্টেশন
add Editor(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()); }
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
email Address | String | যোগ করার জন্য ব্যবহারকারীর ইমেল ঠিকানা। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
add Editor(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
add Editors(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()); }
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
email Addresses | String[] | ব্যবহারকারীদের ইমেল ঠিকানার একটি অ্যারে যোগ করতে হবে। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
add Target Audience(audienceId)
সুরক্ষিত পরিসরের সম্পাদক হিসেবে নির্দিষ্ট লক্ষ্য দর্শকদের যোগ করে।
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
audience Id | String | যোগ করার জন্য লক্ষ্য দর্শকের আইডি। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
can Domain Edit()
স্প্রেডশিটের মালিকানাধীন ডোমেনের সকল ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে। ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি না থাকলে একটি ব্যতিক্রম নিক্ষেপ করে।
// 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());
প্রত্যাবর্তন
Boolean — যদি স্প্রেডশিটের মালিকানাধীন ডোমেনের সকল ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি থাকে তবে তা true ; যদি না থাকে তবে false ।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
can Edit()
ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি আছে কিনা তা নির্ধারণ করে। স্প্রেডশিটের মালিক সর্বদা সুরক্ষিত পরিসর এবং শীট সম্পাদনা করতে সক্ষম।
// 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 (let i = 0; i < protections.length; i++) { const protection = protections[i]; if (protection.canEdit()) { protection.remove(); } }
প্রত্যাবর্তন
Boolean — যদি ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি থাকে তবে true ; যদি না থাকে তবে false
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get 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 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
get Editors()
সুরক্ষিত পরিসর বা শীটের জন্য সম্পাদকদের তালিকা পায়। ব্যবহারকারীর সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি না থাকলে একটি ব্যতিক্রম দেয়।
// Protect the active sheet, then remove all other users from the list of // editors. const sheet = SpreadsheetApp.getActiveSheet(); const 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. const 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
get Protection Type()
সুরক্ষিত এলাকার ধরণ পায়, হয় 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());
প্রত্যাবর্তন
Protection Type — সুরক্ষিত এলাকার ধরণ, হয় RANGE অথবা SHEET ।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get 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', ); // 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
get Range Name()
সুরক্ষিত পরিসরের নাম যদি কোনও নামযুক্ত পরিসরের সাথে যুক্ত থাকে তবে তা পায়। যদি কোনও নামযুক্ত পরিসরের সাথে সুরক্ষা যুক্ত না থাকে তবে null প্রদান করে। মনে রাখবেন যে স্ক্রিপ্টগুলিকে একটি সুরক্ষিত পরিসরকে একটি নামযুক্ত পরিসরের সাথে সংযুক্ত করার জন্য স্পষ্টভাবে set Range Name(rangeName) কল করতে হবে; একটি নামযুক্ত Range থেকে সুরক্ষা তৈরি করতে Range.protect() কল করা, set Range Name(rangeName) কল না করে, তাদের সংযুক্ত করার জন্য যথেষ্ট নয়। তবে, Google Sheets UI-তে একটি নামযুক্ত পরিসর থেকে একটি সুরক্ষিত পরিসর তৈরি করলে সেগুলি স্বয়ংক্রিয়ভাবে সংযুক্ত হয়।
// Protect a named range in a spreadsheet and log the name of the protected // range. const ss = SpreadsheetApp.getActive(); const range = ss.getRange('A1:B10'); const 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 — সুরক্ষিত নামযুক্ত পরিসরের নাম, অথবা যদি সুরক্ষিত পরিসরটি একটি নামযুক্ত পরিসরের সাথে সম্পর্কিত না হয় তবে null
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Target Audiences()
সুরক্ষিত পরিসর সম্পাদনা করতে পারে এমন লক্ষ্য দর্শকদের আইডি ফেরত পাঠায়।
প্রত্যাবর্তন
Target Audience[] — টার্গেট অডিয়েন্সের আইডির একটি অ্যারে।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
get Unprotected Ranges()
একটি সুরক্ষিত শিটের মধ্যে অরক্ষিত রেঞ্জের একটি অ্যারে পায়। যদি Protection অবজেক্টটি সুরক্ষিত শিটের পরিবর্তে একটি সুরক্ষিত রেঞ্জের সাথে মিলে যায়, তাহলে এই পদ্ধতিটি একটি খালি অ্যারে ফেরত পাঠায়। অরক্ষিত রেঞ্জ পরিবর্তন করতে, একটি নতুন রেঞ্জ অ্যারে সেট করতে set Unprotected Ranges(ranges) ব্যবহার করুন; সম্পূর্ণ শিট পুনরায় সুরক্ষিত করতে, একটি খালি অ্যারে সেট করুন।
// Unprotect cells E2:F5 in addition to any other unprotected ranges in the // protected sheet. const sheet = SpreadsheetApp.getActiveSheet(); const protection = sheet.protect(); const 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
is Warning Only()
সুরক্ষিত এলাকাটি "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা নির্ধারণ করে। সতর্কতা-ভিত্তিক সুরক্ষার অর্থ হল প্রতিটি ব্যবহারকারী এলাকার ডেটা সম্পাদনা করতে পারবেন, তবে সম্পাদনা করার সময় ব্যবহারকারীকে সম্পাদনা নিশ্চিত করতে বলার জন্য একটি সতর্কতা প্রম্পট করা হবে। ডিফল্টরূপে, সুরক্ষিত রেঞ্জ বা শিটগুলি সতর্কতা-ভিত্তিক নয়। সতর্কতা অবস্থায় পরিবর্তন করতে, set Warning Only(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);
প্রত্যাবর্তন
Boolean — যদি সুরক্ষিত পরিসর বা শীট শুধুমাত্র সতর্কতা-ভিত্তিক সুরক্ষা ব্যবহার করে তবে true ।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
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. const ss = SpreadsheetApp.getActive(); const protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE); for (let i = 0; i < protections.length; i++) { const protection = protections[i]; if (protection.canEdit()) { protection.remove(); } }
// Remove 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(); }
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
remove Editor(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()); }
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
email Address | String | ব্যবহারকারীর ইমেল ঠিকানা যা সরাতে হবে। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
remove Editor(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
remove Editors(emailAddresses)
সুরক্ষিত শিট বা ব্যাপ্তির জন্য সম্পাদকদের তালিকা থেকে ব্যবহারকারীদের প্রদত্ত অ্যারে সরিয়ে দেয়। মনে রাখবেন যে যদি কোনও ব্যবহারকারী এমন কোনও Google গ্রুপের সদস্য হন যার সম্পাদনার অনুমতি রয়েছে, অথবা যদি ডোমেনের সমস্ত ব্যবহারকারীর সম্পাদনার অনুমতি থাকে, তবুও সেই ব্যবহারকারীরা সুরক্ষিত এলাকা সম্পাদনা করতে পারবেন। স্প্রেডশিটের মালিক বা বর্তমান ব্যবহারকারী কাউকেই সরানো যাবে না।
// Protect the active sheet, then remove all other users from the list of // editors. const sheet = SpreadsheetApp.getActiveSheet(); const 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. const me = Session.getEffectiveUser(); protection.addEditor(me); protection.removeEditors(protection.getEditors()); if (protection.canDomainEdit()) { protection.setDomainEdit(false); }
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
email Addresses | String[] | ব্যবহারকারীদের মুছে ফেলার জন্য ইমেল ঠিকানাগুলির একটি অ্যারে। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
remove Target Audience(audienceId)
সুরক্ষিত পরিসরের সম্পাদক হিসেবে নির্দিষ্ট লক্ষ্য দর্শকদের সরিয়ে দেয়।
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
audience Id | String | টার্গেট অডিয়েন্সের আইডি যেটি অপসারণ করতে হবে। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Description(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
set Domain Edit(editable)
স্প্রেডশিটের মালিকানাধীন ডোমেনের সকল ব্যবহারকারীর সুরক্ষিত পরিসর বা শিট সম্পাদনা করার অনুমতি আছে কিনা তা সেট করে। মনে রাখবেন যে স্পষ্ট সম্পাদনা অনুমতি থাকা যেকোনো ব্যবহারকারী এই সেটিং নির্বিশেষে সুরক্ষিত এলাকা সম্পাদনা করতে পারবেন। যদি স্প্রেডশিটটি কোনও Google Workspace ডোমেনের (অর্থাৎ, যদি এটি একটি gmail.com অ্যাকাউন্টের মালিকানাধীন হয়) অন্তর্গত না হয় তবে একটি ব্যতিক্রম দেয়।
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
editable | Boolean | স্প্রেডশিটের মালিকানাধীন ডোমেনের সকল ব্যবহারকারীর যদি সুরক্ষিত পরিসর বা শীট সম্পাদনা করার অনুমতি থাকে তবে true ; না হলে false । |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Named Range(namedRange)
সুরক্ষিত পরিসরটি একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সংযুক্ত করে। যদি নামযুক্ত পরিসরটি বর্তমান সুরক্ষিত পরিসর থেকে ভিন্ন এলাকা জুড়ে থাকে, তাহলে এই পদ্ধতিটি সুরক্ষাটিকে নামযুক্ত পরিসরের পরিবর্তে কভারে স্থানান্তর করে। নামযুক্ত পরিসরটি বর্তমান সুরক্ষিত পরিসরের মতো একই শিটে থাকতে হবে। মনে রাখবেন যে স্ক্রিপ্টগুলিকে একটি সুরক্ষিত পরিসরকে একটি নামযুক্ত পরিসরের সাথে সংযুক্ত করার জন্য স্পষ্টভাবে এই পদ্ধতিটি কল করতে হবে; একটি নামযুক্ত Range থেকে সুরক্ষা তৈরি করতে Range.protect() কল করা, set Range Name(rangeName) কল না করে, তাদের সংযুক্ত করার জন্য যথেষ্ট নয়। তবে, Google Sheets 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());
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
named Range | Named Range | সুরক্ষিত পরিসরের সাথে সংযুক্ত করার জন্য বিদ্যমান নামযুক্ত পরিসর। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Range(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
set Range Name(rangeName)
সুরক্ষিত পরিসরটি একটি বিদ্যমান নামযুক্ত পরিসরের সাথে সংযুক্ত করে। যদি নামযুক্ত পরিসরটি বর্তমান সুরক্ষিত পরিসর থেকে ভিন্ন এলাকা জুড়ে থাকে, তাহলে এই পদ্ধতিটি সুরক্ষাটিকে নামযুক্ত পরিসরের পরিবর্তে কভারে স্থানান্তর করে। নামযুক্ত পরিসরটি বর্তমান সুরক্ষিত পরিসরের মতো একই শিটে থাকতে হবে। মনে রাখবেন যে স্ক্রিপ্টগুলিকে একটি সুরক্ষিত পরিসরকে একটি নামযুক্ত পরিসরের সাথে সংযুক্ত করার জন্য স্পষ্টভাবে এই পদ্ধতিটি কল করতে হবে; একটি নামযুক্ত Range থেকে সুরক্ষা তৈরি করতে Range.protect() কল করা, set Range Name(rangeName) কল না করে, তাদের সংযুক্ত করার জন্য যথেষ্ট নয়। তবে, Google Sheets UI-তে একটি নামযুক্ত পরিসর থেকে একটি সুরক্ষিত পরিসর তৈরি করলে সেগুলি স্বয়ংক্রিয়ভাবে সংযুক্ত হয়।
// Protect a named range in a spreadsheet and log the name of the protected // range. const ss = SpreadsheetApp.getActive(); const range = ss.getRange('A1:B10'); const 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.
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
range Name | String | সুরক্ষিত করার জন্য নামযুক্ত পরিসরের নাম। |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
set Unprotected Ranges(ranges)
একটি সুরক্ষিত শিটের মধ্যে প্রদত্ত রেঞ্জের অ্যারেকে অরক্ষিত করে। যদি Protection অবজেক্টটি সুরক্ষিত শিটের পরিবর্তে একটি সুরক্ষিত পরিসরের সাথে মিলে যায় অথবা যদি কোনও রেঞ্জ সুরক্ষিত শিটে না থাকে তবে একটি ব্যতিক্রম দেয়। অরক্ষিত রেঞ্জ পরিবর্তন করতে, রেঞ্জের একটি নতুন অ্যারে সেট করুন; সম্পূর্ণ শিটটি পুনরায় সুরক্ষিত করতে, একটি খালি অ্যারে সেট করুন।
// Protect the active sheet except B2:C5, then remove all other users from the // list of editors. const sheet = SpreadsheetApp.getActiveSheet(); const protection = sheet.protect().setDescription('Sample protected sheet'); const 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. const 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
set Warning Only(warningOnly)
এই সুরক্ষিত পরিসরটি "সতর্কতা ভিত্তিক" সুরক্ষা ব্যবহার করছে কিনা তা নির্ধারণ করে। সতর্কতা-ভিত্তিক সুরক্ষার অর্থ হল প্রতিটি ব্যবহারকারী এলাকার ডেটা সম্পাদনা করতে পারবেন, তবে সম্পাদনা করার সময় ব্যবহারকারীকে সম্পাদনা নিশ্চিত করতে বলার জন্য একটি সতর্কতা প্রম্পট করা হয়। ডিফল্টরূপে, সুরক্ষিত পরিসর বা শীটগুলি সতর্কতা-ভিত্তিক নয়। সতর্কতার অবস্থা পরীক্ষা করতে, is Warning Only() ব্যবহার করুন।
// 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());
পরামিতি
| নাম | আদর্শ | বিবরণ |
|---|---|---|
warning Only | Boolean |
প্রত্যাবর্তন
Protection — চেইনিংয়ের জন্য সুরক্ষা সেটিংস প্রতিনিধিত্বকারী বস্তু।
অনুমোদন
এই পদ্ধতি ব্যবহার করে এমন স্ক্রিপ্টগুলির জন্য নিম্নলিখিত এক বা একাধিক স্কোপের অনুমোদন প্রয়োজন:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets