Whenever I run my script, it's adding a new row in between every row that has data, instead of adding a new row in between the cell information changes
Here is the code:
function main(workbook: ExcelScript.Workbook) {
let sheet = workbook.getActiveWorksheet();
let usedRange = sheet.getUsedRange();
let rowCount = usedRange.getRowCount();
for (let i = rowCount; i > 0; i--){
let cellData = sheet.getCell(i,0)
let prevCell = sheet.getCell(i-1,0);
if (cellData == prevCell) {
continue;
}
if (cellData == sheet.getCell(99,99)){
continue;
}
if(cellData != prevCell){
cellData.getEntireRow().insert(ExcelScript.InsertShiftDirection.down);
}
}
}