johny why
johny why

Reputation: 2201

How to enable new synchronous Excel Javascript API?

This article says a new simplified Office API is in "Preview" mode. Who gets to preview it? When will it come out of Preview (been almost a year)? Will it be available in Excel online? Is a special license required? I'm using the free Excel online.

If i create a script containing the following:

function main(workbook: ExcelScript.Workbook) { 
  // Your code goes here 
}

i just get an error "Cannot find namespace 'ExcelScript'." Can i enable this by adding something to the Libraries tab?

Upvotes: 0

Views: 1663

Answers (3)

johny why
johny why

Reputation: 2201

The "new synchronous Excel Javascript API" is formally known as "Office Scripts", or "Office Scripts in Excel on the web".

This TypeScript-based programming interface is only available to paid licensed business or educational accounts, or through a free Developer account.

With any of these types of accounts, the Office Scripts IDE can be accessed through the "Automate" tab in Excel on the web.

In new Developer accounts, it's enabled by default. In paid licensed accounts, it may need to be enabled at https://admin.microsoft.com > left-pane 'Show All' > Settings > Settings (or Org Settings) > Office Scripts.

It's not available to standard free (non-developer) Office 365 accounts. Only vanilla Javascript is available, through the Script Lab Add-in. Office Scripts entered into the Script Lab IDE will raise errors, as described in the OP.

Upvotes: 3

Sudhi Ramamurthy
Sudhi Ramamurthy

Reputation: 2478

This API is part of Office Scripts application, which is a scripting platform. The API is not available for add-ins, which still uses Office-js. My read is that you attempted to use this in Script-Lab, which again is an add-in playground.

Upvotes: 3

Rick Kirkham
Rick Kirkham

Reputation: 9674

For details see Office Script Documentation. In particular, it is available on the Automate tab of Excel on the web. See here: Office Scripts for Excel on the web.

Upvotes: 2

Related Questions