Answer the question
In order to leave comments, you need to log in
What formula will return the name of the Sheet in cell "A1"?
Hi all! The task is this: 1. There is a Google
Spreadsheet
in which "Sheet 1" is created
. if I change the name of the sheet, so that the value in the cell also changes.
Answer the question
In order to leave comments, you need to log in
Hello.
You can create your own function based on Google Apps Script .
Code.gs
function sheetName() {
return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
}
function sheetsName() {
return SpreadsheetApp.getActiveSpreadsheet().getSheets().map(function(s){return s.getName()});
}
=sheetName(E5:E13)
=sheetsName(E5:E13)
E5:E13
special, necessarily active, i.e. user input dependent range. Without changing this range, the function will be of little use. Hello,
below is another solution to your question, it does not need ranges.
Just give a sheet number from 1 to N, where N is the last sheet.
The instruction is very simple and short:
- Copy the code below (all with all brackets, slashes and commas):
//функция возврата имени листа по порядковому номеру
function getSheetName(num) {
//переменная 'num' в строке выше - номер вашего листа и для обычного пользователя первый лист num = 1,
//но с точки зрения программирования он имеет другой номер на 1 меньше (пользователи, не прьтесь почему так - сейчас не важно),
//то есть то что для пользователя =1 для программы =0, поэтому ниже мы сдвигаем значение cellNumber на -1.
var cellNumber = num-1;
return SpreadsheetApp.getActiveSpreadsheet().getSheets()[cellNumber].getSheetName();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question