Hi All!
So I’m facing strange issue, I have prepared Office Scripts for Excel and when I run them directly in Excel everything works but as son as I want to run them via Power Automate I'm getting errors.
Issue 1
This works fine:
workbook.getWorksheet("Sheet1").setName("SampleName");
This doesn't work:
let SampleVariable = "SampleName";
workbook.getWorksheet("Sheet1").setName(SampleVariable);
and return error:
Błąd skryptu Office JS: Line 35: {"message":"The argument is invalid or missing or has an incorrect format.","code":"InvalidArgument","type":"Worksheet","method":"setName","line":34}
As mentioned when running scripts directly in Excel both methods works just fine.
Issue 2
This code works fine when run in Excel but doesn't work in Power Automate:
let selectedSheet = workbook.getWorksheet("SampleName");
let SampleRng = selectedSheet.getUsedRange();
and return error:
Błąd czasu wykonywania: Line 59: Cannot read properties of undefined (reading 'getUsedRange')
Anyone have a workaround?