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

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

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 1 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
  5. Continue learning

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.

Advertisement

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.

Advertisement

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 Comment