Office Scripts(Microsoft Excel)


Japanese version.

Office Scripts are programs for automating Excel; by using Office Scripts, you can automate tasks that would be too complicated to do manually. For example, if you perform the same task every day, you can save time by automating it using Office Scripts.

Office Scripts are used to manipulate Excel cells, sheets, and workbooks. For example, they can read or write values in Excel cells or change the background color of cells. It can also create, delete, and rename Excel sheets.

Office Scripts are based on a programming language called JavaScript, which is one of the easiest programming languages to learn for beginners. Like macros, it can also record operations.


Comparison between Office Script and Macro (VBA)

Ease of learning

Both languages are easy for beginners to learn, but Office Scripts is slightly superior due to its later development and sophistication; learning Office Scripts also has the advantage that learning Office Scripts will lead to learning JavaScript.


Neither is superior to the other, but there are some differences as follows

Office scripts are cloud (web) compatible and can be handled in a browser.

Macros (VBA) are only available for desktop applications, but have more features and can often only be done here.

Future Prospects

Office Scripts is superior. At present, even if the functions are inferior, they are being developed additionally, and macros (VBA) have many security issues and are reluctant to develop additional functions.

Macros (VBA) have many functions that are beyond the scope of Excel, such as browser operations, and it is highly likely that such functions will not be added to Office Scripts, but will be migrated to Power Automate Desktop instead of having such functions in Excel. We will not have such functions in Excel, but will move them to Power Automate Desktop.


Script Recording and Run.

Basic operations.


Set value to cell / Get value from cell

Delete cells, rows, and columns

Clear cells, rows, and columns.

Insert cells, rows, and columns.

Cells copy/paste.

Cells cut/paste.

Cell Fill.

Set Font.

Set Indent.

Set text wrap.

Set hyperlink.

Get hyperlink information.


Add Worksheet.

Rename Worksheet.

Move Worksheet.

Copy Worksheet.

Delete Worksheet.

Show/Hide Worksheet.

Specify the range of use.

Used (last row and last column with values) Get last row and last column.

Set row height and column width.

Set Freeze Panes.

Set show/hide rows/columns.

Set Tab color.

Search for a string from a Worksheet.

Replace String in Worksheet.


Get all Worksheets in the Workbook.

Check if the workbook is opened as read-only.

Basic Syntax

Basic usage of variables.


String concatenation operators

Arithmetic operators

Conditional branches and logical operators



Multidimensional array

Associative array

Error (exception) handling.


Add Chart

Get/Change the current position of the chart

Get/Change chart size.

Get/Change Chart name.