0

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?

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32
johny why
  • 2,047
  • 7
  • 27
  • 52
  • 2
    I think it's harsh voting this down, I spent a few days trying to understand what Microsoft were on about with JS & Office several months ago & it was not clear or easy to follow - I gave up. Glad you asked the question, it is a valid contribution in my view - as of course is the answer – Tin Bum Sep 05 '21 at 16:08

3 Answers3

3

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.

johny why
  • 2,047
  • 7
  • 27
  • 52
2

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.

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32
  • Apparently, requires paid OneDrive Business, plus paid a commercial or educational Microsoft 365 license. Ouch. Is it available free in any way, such as with a free Developer account? – johny why Apr 10 '21 at 22:57
  • Doesn't answer the question "How to enable it". – johny why Apr 11 '21 at 12:19
2

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Sudhi Ramamurthy
  • 2,358
  • 1
  • 10
  • 14