Skip to content

Instantly share code, notes, and snippets.

@oshliaer
Created June 22, 2018 12:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oshliaer/ac39eb94d4392c8b5df9f9953f2a2759 to your computer and use it in GitHub Desktop.
Save oshliaer/ac39eb94d4392c8b5df9f9953f2a2759 to your computer and use it in GitHub Desktop.

Set Data Validation

function setDataValidation() {
// Ресурс
var resource = {};
// Запрос
var request = {};
// Для диапазона
var range = {
"sheetId": 0,
"startRowIndex": 0,
"endRowIndex": 1,
"startColumnIndex": 0,
"endColumnIndex": 1
};
// Правило
var rule = {
"condition": {
"type": "BOOLEAN"
},
"strict": true
};
// Действие
request.setDataValidation = {
range: range,
rule: rule
}
// Создать и заполнить очередь
resource.requests = [];
resource.requests.push(request);
// Выполнить пакетом очередь
Sheets.Spreadsheets
.batchUpdate(resource, SpreadsheetApp.getActive().getId());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment