2017-09-12 5 views
0

私はフォームのレスポンスシートを持っていて、read onlyモードになるように行を作りたかったのです。 Google Apps Scriptを使用してそれを達成するにはどうすればよいですか。Google Apps Scriptを使用してスプレッドシートで読み取り専用の行を作成する方法は?

ありがとうございました!これを解決する

+0

[documentation](https://developers.google.com/apps-script/reference/spreadsheet/protection)に従ってください。役立つでしょう。 –

答えて

0

二つの方法:

Appsスクリプト

スプレッドシート(​​documentation)の保護クラスを使用します。これにより、組み込みセル保護メカニズムへのアクセスが可能になります。あなたはDataメニューを経由してシートアプリ内からセル&範囲の保護メカニズムにアクセスできるアプリケーション

シートで

// 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 will throw an exception upon removing the group. 
protection.removeEditors(protection.getEditors()); 
if (protection.canDomainEdit()) { 
    protection.setDomainEdit(false); 
} 
// Now the range is not editable by anyone. 
// Just add yourself back to the editors list if necessary. 
protection.addEditor(Session.getEffectiveUser()); 

: はここでの例では、読み取り専用範囲を作成するためのマニュアルを参照して、フォームの。 Data>Protect sheets and ranges...を選択し、サイドバーで権限を設定します。

関連する問題