
📎 This article includes 1 downloadable practice file ↓
The real power of Office Scripts: Power Automate can run them on a schedule or when something happens, with no one opening Excel.
Parameters and return values
function main(workbook: ExcelScript.Workbook, region: string): number {
// ... calculate
return total;
}
Extra parameters after workbook appear as inputs in Power Automate; the return value becomes dynamic content for later steps.
The flow
- Scheduled cloud flow, daily at 8:00.
- Excel Online (Business) › Run script: choose the file and script, enter region “North”.
- Send an email with the script’s result.
Limits
Scripts run up to a few minutes, and Power Automate limits daily script runs per user; fine for daily reports, not for thousands of runs.
Where people go wrong
| Problem | Fix |
|---|---|
| Script not listed in the flow | Save it to the default Office Scripts folder in OneDrive |
| File locked | Close it in desktop Excel |
That’s the Office Scripts course.
Practice
Create a Sales table and a Summary sheet, save the script, then call it from a scheduled flow.
📎 Practice files for this article
- 📝Lesson 5 Office ScriptPaste into Excel on the web > Automate > New Script.⬇ TS · 636 B
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.
Stuck on a step? Ask a question and the AI answers using this article.