Is there a code for repetitive merging. Like for example I want to merge A1:B1, then again A2:B2, then A3:B3 and so forth. It goes a long way up to 500th cell A500:B500?
I am familiar with this code:
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
selectedSheet.getRange("A2:B2").merge(false);
selectedSheet.getRange("A2:B2").getFormat().setHorizontalAlignment(ExcelScript.HorizontalAlignment.center);
}
Are there a few lines code to apply it multiple times, to avoid actually repeating the merging of 2 cells while recording?