2017-09-12 7 views
0

양식 응답 시트가 있는데, 어떤 행을 read only 모드로 만들고 싶습니다. Google Apps Script를 사용하여이를 어떻게 달성 할 수 있습니까? 아니면 다른 방법도 사용할 수 있습니다.Google Apps Script를 사용하여 스프레드 시트에서 읽기 전용 행을 만드는 방법은 무엇인가요?

감사합니다. 이 문제를 해결하기 위해

+0

[documentation] (https://developers.google.com/apps-script/reference/spreadsheet/protection)을 따라 가면 도움이 될 것입니다. –

답변

0

두 가지 방법 :

애플리케이션 스크립트

당신은 스프레드 시트 (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...을 선택한 다음 사이드 바에서 권한을 설정하십시오.