簡體   English   中英

與Google腳本共享工作表時出錯

[英]Error when sharing Sheet with Google Script

與運行Google腳本的按鈕共享Google表格時,我遇到以下問題:-當我自己的人單擊該按鈕時,腳本將返回以下錯誤:“您正在嘗試編輯受保護的單元格或對象。請聯系電子表格所有者,如果您“”

我在工作表中有幾個受保護的范圍(現在已將其刪除),但沒有一個甚至靠近按鈕。 我試圖在一個共享用戶的帳戶上添加一個按鈕,並將腳本復制到新的腳本文件中(將共享用戶創建/復制的腳本重新鏈接到共享用戶創建的按鈕),但是沒有有用。

有誰知道解決這個問題的辦法嗎?

僅刪除單元格值就不能刪除保護。 類保護中有一個示例代碼,顯示了在工作表范圍內添加和刪除保護:

 // 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();
   }
 }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM