Last active
September 9, 2018 10:41
-
-
Save Padilo300/a227500b850a2bbe34854dbeebfe710c to your computer and use it in GitHub Desktop.
API google sheets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction() { | |
var t1 = SpreadsheetApp.getActive(), // получили доступ к текущей таблице | |
t2 = SpreadsheetApp.openById("1_9snuJs2glBYHbkq5C8f6PeeA0DGrIyn1MTHa9Hi4ro"); // получили доступ к другой таблице по id | |
var list1 = t1.getSheetByName("finish") ; // получили достпу к листу | |
var list2 = t2.getSheetByName("Отчет") ; // получили достпу к листу | |
var data = list1.getRange('M4:Q7').getValues() ; // получили значения ячееек текущей таблицы | |
var lastRow = list2.getLastRow()+2 ; // получили последнюю заполненную строку +2 пустая | |
// ЛИСТ.getRange(СтрокаСтарт,КолонкаСтарт,Строка финиш,Колонка финиш).setValues(data) | |
list2.getRange(lastRow,1,4,5).setValues(data) ; // вставили данные в выбранный диапазон ячееек | |
list2.getRange("A" + lastRow + ":A" + (lastRow + 3) ).merge() ; // обьеденили ячейки (последняя строка + последняя строка +3 ) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
SpreadsheetApp.getUi().createMenu("СКРИПТ").addItem("сведение и отрправка", "myFunction").addToUi(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment