web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / スクリプトを実行できませんでした。もう一度お...
Power Automate
Suggested Answer

スクリプトを実行できませんでした。もう一度お試しください。 Office JS エラー:Line 11: Worksheet getRange: Timeoutが発生する

(1) ShareShare
ReportReport
Posted on by

ExcelスクリプトをPower Autometeから実行する方法について知りたいです。
今、Excel上でスクリプトは正常に実行できてもPower Autometeから実行すると、「スクリプトを実行できませんでした。もう一度お試しください。」と表示され、スクリプトが実行できません。どのように対処したらよいでしょうか?

やりたいことは、「URLリンクをExcelを開かずに更新させたい。」で、スクリプトを介してセル値の直接更新ができないようなので、Script1で一旦再計算した結果(値)をフローに返却した後、Script2を用いて値を別のセルに値を設定するようにしたいと考えています。
大まかに、フローは以下を作成しています。

①Excel「スクリプトの実行」アクション

 Script1の実行(以下処理)

  1)WorkSheetを再計算(workbook.getApplication().calculate(ExcelScript.CalculationType.full);)

  2)結果を返却

②「JSONの解析」アクション

 ①の結果を格納

③「Apply to Each」アクション

 ②の結果を配列に格納

④Excel「スクリプトの実行」アクション★ここでエラー発生

 Script2の実行(※以下処理のgetRanceで発生。対象行は、50行)

function main(workbook: ExcelScript.Workbook,values:string[]) {
    // シートを取得
    let sheet = workbook.getWorksheet("Sheet1"); // シート名を変更
    // G列に値を設定
    for (let i = 0; i < values.length; i++) {
        // A列のセルアドレスを生成
        let cellAddress = "A" + (i + 2); // A2から開始するため、i + 2
 
        // セルを取得
        let dateRange = sheet.getRange(cellAddress);
 
        // 値を設定
        dateRange.setValue(values[i]);
    }
 
}
 
 
 
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]);
}
}
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,452 Super User 2025 Season 2 on at
     
     
    its literally a step by step guide and will help you understand limitations etc.
     
    If this helps, please mark as such and maybe a like :-)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard