Applies To
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web

Automate your repetitive tasks with Office Scripts in Excel for the web, Windows, and Mac. Create scripts and replay them whenever you want. Share your scripts across the organization to help others make their workflows fast and consistent. Edit your scripts as your workflow changes and let the cloud update your solutions across the organization.

Create an Office Script

There are multiple ways to make a new Office Script.

  • Record your actions with the Action Recorder. This is great when you have consistent actions that you take on your workbooks. No coding knowledge is needed to record and share Office Scripts. Get started recording with Record your actions as Office Scripts.

  • Use the code editor in the Office Scripts task pane to work with TypeScript for advanced scripts. To learn how to start with the Action Recorder and edit scripts to better suit your needs, see the tutorial Create and format an Excel table.

  • Draft a script with AI. Use this approach to generate a starter script and then review and modify it to fit your needs. Note that this feature is in preview and may not be available to everyone.

Run an Office Script

  1. To view your scripts, go to Automate > View Scripts and then select Recent Scripts or Scripts from this Workbook to open the Office Scripts task pane.

    Tip: Your scripts can also be directly selected from the Office Scripts Gallery.

    Select Automate to see Office Scripts options.
  2. Once the Office Scripts task pane is open, select the Run button to start the script. You'll see a brief notification that the script is running, which disappears when the script is complete.​​​​​​​

    Select Run in the Office Script card to run the script.
  3. More options - Select the ellipsis menu (...) on the right-hand corner of the script card to see the contextual menu. Here, you have options to:

    • Delete the script.

    • Make a copy of the script.

    • Move the script to another location.

    • Integrate the script with Power Automate by using Automate a task.

Troubleshooting

The following sections have guidance on common issues. For more information, visit Troubleshoot Office Scripts. You can also ask an expert in the Excel Tech Community or get support in Communities.

Automate tab not appearing or Office Scripts unavailable

The following steps should help troubleshoot any problems related to the Automate tab not appearing in Excel.

  1. Make sure your Microsoft 365 license includes Office Scripts.

  2. Ensure third-party cookies are enabled (when using Excel on the web).

  3. Ensure that your admin has not disabled Office Scripts in the Microsoft 365 admin center.

  4. Ensure that your admin has not configured a group policy to block Office Scripts (Windows only).

  5. Install WebView2 (Windows only).

  6. Ensure you're not logged in as an external or guest user to your tenant.

Script errors

Certain actions may be fine the first time you record your script, but fail when you run it again. This might be because of different worksheet names, missing tables, or other differences between workbooks. Error notices from the script are displayed in the Office Scripts task pane.

Select View logs to see more about the errors.

Select View logs to display a brief error explanation in the Output tab of the code editor.

See script errors in the Output log.

Unsupported features

We're constantly working to add support for more features, but at this time not everything is supported. When this happens, you'll see a note in the Record Actions pane. Such actions aren't added to the script and will be ignored.

The Action Recorder shows "This action is not yet recordable" if an action is not supported.

See also

Record your actions as Office Scripts

Office Scripts technical documentation

Tutorial: Create and format an Excel table

Sample scripts for Office Scripts in Excel on the web

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.