Share via

Range delete: There was an internal error while processing the request.

Becki 0 Reputation points
2023-11-12T20:15:32.35+00:00

I'm trying to run this script and it worked the first time I ran it, but subsequent runs do not work. I get this error:

Line 13: Range delete: There was an internal error while processing the request.

Here is my script:

function main(workbook: ExcelScript.Workbook) {
	let u7 = workbook.getWorksheet("U71");
	let existingTable = u7.getTables()[0];
	// Create a table with format on u7
	let table1 = workbook.addTable(u7.getRange(), true);
	table1.setPredefinedTableStyle("TableStyleLight13");
	// Apply checked items filter on table column    Plan Num
	table1.getColumnByName("   Plan Num").getFilter().applyValuesFilter(["*  38303", "** 38303", "***", "Plan Num"]);
	let visibleRows = table1.getRangeBetweenHeaderAndTotal().getVisibleView().getRows()
	let firstVisibleRow = visibleRows[0].getRange().getRowIndex() + 1
	let lastVisibleRow = visibleRows[visibleRows.length - 1].getRange().getRowIndex() + 1
	u7.getRange(`${firstVisibleRow}:${lastVisibleRow}`).delete(ExcelScript.DeleteShiftDirection.up);
}

Thanks, Becki

Microsoft 365 and Office | Development | Office JavaScript API
Microsoft 365 and Office | Development | Other
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.