I would like to know how to run an Excel script from Power Automete.
Currently, the script can be run normally in Excel, but when I run it from Power Automete, the message "Script could not be run. Please try again" appears and the script cannot be run. What should I do?
What I want to do is to "update a URL link without opening Excel." Since it seems that I cannot directly update cell values via a script, I would like to have Script1 return the recalculated result (value) to the flow, and then use Script2 to set the value in another cell.
Roughly speaking, the flow is created as follows.
①Excel "Run Script" action
Run Script1 (process below)
1) Recalculate WorkSheet (workbook.getApplication().calculate(ExcelScript.CalculationType.full);)
2) Return the result
② "Parse JSON" action
Store the result of ①
③ "Apply to Each" action
Store the result of ② in an array
④Excel "Run Script" action ★ Error occurs here
Run Script2 (※ Occurs in getRance in the process below. The target row is row 50)
function main(workbook: ExcelScript.Workbook,values:string[]) {
// Get the sheet
let sheet = workbook.getWorksheet("Sheet1"); // Change the sheet name
// Set the value in column G
for (let i = 0; i < values.length; i++) {
// Generate the cell address of column A
let cellAddress = "A" + (i + 2); // Start at A2, so use i + 2
// Get the cell
let dateRange = sheet.getRange(cellAddress);
// Set the value
dateRange.setValue(values[i]);
}
}