Office Scripts Lesson 1: What Office Scripts Are and the Action Recorder

📎 This article includes 1 downloadable practice file ↓

⏱ 2 min read

📘 Office Scripts Beginner Course · Lesson 1 of 5

In this article
  1. Find it
  2. Record and read
  3. VBA vs Office Scripts
  4. Practice

Office Scripts are Excel’s newer automation: scripts stored in OneDrive, written in TypeScript, running in Excel on the web and the new Excel desktop. Unlike VBA they can be triggered by Power Automate without anyone opening the file.

Find it

Excel on the web › Automate tab (needs a Microsoft 365 business or education licence). Record Actions captures what you do; New Script opens the code editor.

Record and read

Record: bold the header, fill it green, autofit columns. Stop. The editor shows code like:

function main(workbook: ExcelScript.Workbook) {
  const sheet = workbook.getActiveWorksheet();
  sheet.getRange("A1:F1").getFormat().getFont().setBold(true);
}

Every script has a main function that receives the workbook. Objects (sheet, range, format) have get/set methods.

VBA vs Office Scripts

VBA Office Scripts
Runs in Desktop Excel Excel web/new desktop, Power Automate
Language VBA TypeScript
Other apps (Outlook, files) Yes No (use Power Automate)
Stored Inside the file OneDrive, shareable
💡 Record first, then edit. The recorder gives you the exact method names, which is the hardest part when starting.

Practice

Paste the script into a new Office Script, run it on a sheet with data, then record your own small macro and compare.

📎 Practice files for this article

  • 📝
    Lesson 1 Office ScriptPaste into Excel on the web > Automate > New Script.
    ⬇ TS · 429 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.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *