Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

You can automate your repetitive tasks with the Office Scripts Action Recorder in Excel and record your actions as scripts to replay whenever you want. You can edit your scripts as your workflow changes. Office Scripts are stored in the cloud, letting you and your team update all your workbooks as needed. 

Note: Before you can use Office Scripts, an administrator must enable them.

The Action Recorder creates a script based on your changes to a workbook. These actions can include entering text or numbers, performing commands from the ribbon or from the menus, formatting cells, rows, or columns, creating Excel tables, and so on. The task pane displays a descriptive list of all the steps you’re taking.

Note: You don’t need any coding experience to record and run Office Scripts. You can choose to edit your actions from the Code Editor, where you'll work with the script’s TypeScript code. Learn all about writing scripts with the Code Editor with the tutorial Record, edit, and create Office Scripts in Excel.

Requirements

  • An active Microsoft 365 subscription account with a commercial or educational Microsoft 365 license that has access to the Microsoft 365 Office desktop apps. This includes:

    • Microsoft 365 Apps for business

    • Microsoft 365 Business Standard

    • Microsoft 365 Apps for enterprise

    • Office 365 ProPlus for Devices

    • Office 365 Enterprise E3

    • Office 365 Enterprise E5

    • Office 365 A3

    • Office 365 A5

  • OneDrive for Business.

  • Server authentication - When first running the Script Recorder or Code Editor, you need to authenticate with the server, so your scripts can be saved to the cloud. Sign-in to your Microsoft account as usual, then when you see the Permissions requested prompt, choose Accept to continue.

Note: Once you’ve toggled on the correct setting in the admin center, end users with the appropriate license can access the feature. This feature is not yet available in Microsoft 365 for US Government and customers with data residency in one of the new local datacenter geos.

Get started

  1. First, select the Automate tab on the ribbon. This shows your two primary options in the Scripting Tools group: Record Actions and New Script.

           Scripting Tools

  2. To create a new Office Script, press the Record Actions button, then start taking the steps you want to automate. For this example, we're taking a data range, converting it to an Excel table, adding a total column and total row, and finishing by formatting our values as currency. 

  3. When you start to record a new Office Script, a Record Actions task pane opens on the right. Here you'll see an ordered list of the actions you're taking. When you're done with all your steps, press the Stop button.

  4. Once you've pressed the Stop button, the Code Editor pane displays your new script. 

  5. By default, Excel names your scripts "Script 1", "Script 2", and so on. However, you'll want to give your scripts meaningful names and descriptions. To give your script a new name, select the More options (...) menu and select Rename from the pop-up menu. 

Apply relative mode

Important: This feature is currently in preview. It’s subject to change based on your feedback. Please give us suggestions by going to Help > Feedback to submit your ideas. 

Relative mode helps your recorded script be more flexible. When you don’t have the exact same cell positions of the data you’re working on, you can turn on relative mode. 

Default absolute mode                                   vs

  • The exact cell locations are recorded: editing A3 will edit A3 every time the script is run.

  • Better when the cells you work with are the same cell addresses every time.

Relative mode

  • The cell locations are based off your selected cell. If you start recording the script with cell A1 selected and edit A3, the script always edits the cell that is two rows below the currently selected cell.

  • Best used when your script acts on the current cell or surrounding cells.

  1. Select the drop-down menu in the Record Actions task pane.

  2. Select Absolute mode.

Relative mode

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers Community.

See also

Introduction to Office Scripts

Office Scripts technical documentation

Record, edit, and create Office Scripts in Excel

Troubleshooting Office Scripts

Sample scripts for Office Scripts in Excel

Create a button to run an Office Script

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×