Answer the question
In order to leave comments, you need to log in
What function can be used to find out how many cells are merged?
Tell me, with what function can I find out the exact number of combined rows and columns in one cell?
There are features such as:
getRowSpan()
getColumnSpan()
Answer the question
In order to leave comments, you need to log in
Example in Spreadsheet https://docs.google.com/spreadsheets/d/1mkUDHVX1b5...
TryRange.isPartOfMerge()
function myFunction() {
const book = SpreadsheetApp.getActiveSpreadsheet();
const range = book.getRange('C5');
const mergedRange = range.getMergedRanges()[0];
if (mergedRange) {
const countCells = mergedRange.getValues()[0].length * mergedRange.getValues().length;
console.log('Входит в объединенную ячейку?', range.isPartOfMerge());
console.log('Диапазон объединения:', mergedRange.getA1Notation());
console.log('Количество объединенных ячеек:', countCells);
console.log('Количество строк в объединенном диапазоне:', mergedRange.getValues().length);
} else {
console.info('Ячейка не объединена');
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question