Skip to main content

Office 365: Blog

Excel

New additions to Excel JavaScript APIs 

Excel JavaScript APIs, which are part of the Office.js library, provide a rich set of APIs that you can use to build powerful solutions within Excel that run on multiple platforms. We continue to expand the API surface to add support for new scenarios and functionality that enables deeper and richer integration with Excel workbooks. To that end, we’re excited to announce the general availability of Excel JavaScript API requirement sets 1.5 and 1.6 across all supported platforms and to introduce public preview (beta) access for additional APIs on Windows and Online platforms (with support for other platforms coming soon).

In this post, we’ll highlight some of the new Excel JavaScript APIs and point you to helpful getting started resources. As always, we’re eager to hear your feedback. Try out the new APIs and let us know what you think!

What’s new

General availability

Excel JavaScript API requirement sets 1.5 and 1.6

With the addition of support for iPad and MacBook, we are pleased to announce that Excel JavaScript API requirement sets 1.5 and 1.6 are now generally available (GA) on all supported platforms (Windows, Excel Online, MacBook, iPad.) These requirement sets include APIs for:

  • Custom XML parts: Allows you to add and manage custom XML data. Use custom XML to store information needed to understand state of the add-in, drive workflow and business logic.
  • Conditional formatting: Allows you to quickly highlight important information in a spreadsheet using built-in rules and custom formulas. Use this feature to help users visually explore and analyze data, detect critical issues, and identify patterns and trends.

To learn more about the APIs in requirement sets 1.5 and 1.6, see this link: Excel JavaScript API requirement sets.

Expanded support for the Document.getFileAsync API

The Document.getFileAsync method, which you can use in your Excel add-in to download the current workbook, is now available across all supported platforms (Windows, Excel Online, Mac, and iPad). This enables you to retrieve the Excel workbook content and carry out post processing such as back-up, format conversion, etc.

New APIs available in public preview (beta)

Public preview (beta) access is now available for several new Excel JavaScript APIs on Windows and Excel Online (with support for other platforms coming soon). The following sections highlight the functionality that these new APIs provide.

Customize charts

With the new APIs that are available in public preview, you can do things such as create a line chart, add a data series to a chart, set the chart title, add an axis title, add display unit, add a trendline with moving average, change a trendline to linear, and more.

Perform validation of input data

New data validation APIs will allow setting up new range data validation rules (drop-down buttons) based on pre-defined list, formulas, date, time or custom values, manage input and error messages.

Customize the appearance of worksheets and ranges

With the new APIs that are available in public preview, you can customize the appearance of worksheets in multiple ways:

  • Freeze panes to keep specific rows or columns visible when you scroll in the worksheet. For example, if the first row in your worksheet contains headers, you might freeze that row so that the column headers will remain visible as you scroll down the worksheet.
  • Set the visibility of gridlines in a worksheet.
  • Modify worksheet tab color.
  • Add worksheet headings.

With the new APIs that are available in public preview, you can customize the appearance of ranges in multiple ways:

  • Set the cell style for a range to ensure sure that all cells in the range have consistent formatting. A cell style is a defined set of formatting characteristics, such as fonts and font sizes, number formats, cell borders, and cell shading. Use any of Excel’s built-in cell styles or create your own custom cell style.
  • Set the text orientation for a range.
  • Add or modify a hyperlink on a range that links to another location in the workbook or to an external location.

Manage document properties

With the new APIs that are available in public preview, you can access built-in document properties and also create and manage custom document properties to store state of the workbook and drive workflow and business logic.

Copy worksheets

Copy the data and format of from one worksheet to a new worksheet within the same workbook using simple worksheet copy API and reduce the amount of data transfer needed.

Handle ranges with ease

With the new APIs that are available in public preview, you can do things such as get the surrounding region, get a resized range, and more. These APIs should make tasks like range manipulation and addressing much more efficient.

Note: To access APIs that are in public preview, you must use the beta library of the Office.js CDN: https://appsforoffice.microsoft.com/lib/beta/hosted/office.js along with Excel Online or latest version of Excel monthly channel version.

Want to learn more?

Excellent! Visit the Excel JavaScript API Open Specification, where you’ll find documentation and code samples to help you learn more about the new API features now available in public preview.

Additionally, you can try out the new API features by using the built-in code snippets that are available in Script Lab. In Script Lab, you’ll find samples that use preview APIs listed in the Preview APIs category:

We encourage you to try out the new APIs and tell us what you think. You can post questions about the APIs on StackOverflow (with the office-js tag), make suggestions for the docs on GitHub, or suggest new API features on UserVoice.

filter-icon