Skip to main content

What is Office Scripts?

Office Scripts is a script language that runs on the web version Excel (Excel On the Web).

It is equivalent to VBA macros in the on -premises version.

It is written in TypeScript and has a significantly different notation from VBA, but it is a language that is easy to handle for those who are used to Google Apps Script.

In this chapter, you can touch the difference from VBA and understand how to use the Office Scripts while playing with a sample code.

About the sample code on this site

The Office Scripts is TypeScript and TypeScript is JavaScript.

JavaScript has a long history and has become very convenient with repeated standards, but as a negative effect, it can be realized by various description methods.

This site is trying to create a sample code using strict and secure notation, but does not force the notation.

The important thing is that consistent notation is used through the project.

caution

VBA can be used not only for Excel but also on Word and Access, but at this time Office Scripts is a script language exclusively for Excel.

Sample sample

This site provides samples as follows.

Sample sample
function main(workbook: ExcelScript.Workbook) {
const fruits: string[] = [];

fruits.push('Apple', 'Orange', 'Banana');

const labels = fruits.map<string>((fruit, i) => {
return `${i + 1}th fruit is ${fruit}.`;
});
}