I am trying to delete the last row in my Excel Online document using Office Scripts.
I do not know what I am doing wrong, it is not deleting, does anyone have an idea?
My code:
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
//getting the used range in the worksheet
let usedRange = workbook.getActiveWorksheet().getUsedRange();
//getting the row count of the used range
let lastRow = usedRange.getRowCount();
//getting the row count of the range
let rowCount = usedRange.getRowCount();
usedRange.getCell(lastRow, 0).getEntireRow().delete(ExcelScript.DeleteShiftDirection.up)
}