Good day,
So as the final action in a flow I want Power Automate to run an excel script. When I run this script manually in excel it works no problem.
When I ask PA to run it I get an error message
We were unable to run the script. Please try again.
Runtime error: Line 5: _a.sent(...).findAsync is not a function
clientRequestId: 0e46d584-7d5a-4ad4-a222-1a051bdb220b
Script below, any help would be apprciated.
function main(workbook: ExcelScript.Workbook) {
let worksheet = workbook.getWorksheet("Change Order Form");
let table = worksheet.getTables().find(t => t.getName() === "table5");
let tableDataRange = table.getRangeBetweenHeaderAndTotal();
let dataValues = tableDataRange.getValues();
let removed = 0;
for (let i = dataValues.length - 1; i >= 1; i--) {
let rowData = dataValues[i];
let isEmptyRow = rowData.every(value => value === '');
if (!isEmptyRow) {
let rowToDelete = tableDataRange.getRow(i);
rowToDelete.delete(ExcelScript.DeleteShiftDirection.up);
removed++;
}
}
console.log(`Removed ${removed} rows.`);
}