Advertisement
Namokonov

Untitled

Aug 23rd, 2020
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Получаем название таблицы
  3.  * @customfunction
  4.  */
  5. function имя_таблицы() {
  6.   return SpreadsheetApp.getActive().getName();
  7. }
  8.  
  9. /**
  10.  * Выводит список листов книги и ссылок на них
  11.  * @customfunction
  12.  */
  13. function листы_книги() {
  14.   const url = SpreadsheetApp.getActive().getUrl();
  15.   return SpreadsheetApp.getActive().getSheets().map(g => [g.getName(), url + "#gid=" + g.getSheetId()])
  16. }
  17.  
  18. /**
  19.  * Выводим текущий лист и ссылку на него
  20.  * @customfunction
  21.  */
  22. function текущий_лист() {
  23.   const ss = SpreadsheetApp.getActive();
  24.   const sh = SpreadsheetApp.getActiveSheet();
  25.   return [[sh.getName(), ss.getUrl() + "#gid=" + sh.getSheetId()]];
  26. }
  27.  
  28. /**
  29.  * Выводим листы и диапазоны
  30.  * @customfunction
  31.  */
  32.  
  33. function листы_диапазоны() {
  34.  
  35. return [['Лист', 'Диапазон с данными', 'Границы листа']].concat(SpreadsheetApp.getActive().getSheets()
  36.      .map(g => [g.getName(), g.getDataRange().getA1Notation(), g.getRange(1, 1, g.getMaxRows(), g.getMaxColumns()).getA1Notation()]))
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement