String concatenation operators.(Microsoft Excel Office Scripts)


Japanese version.

This section introduces the use of string concatenation operators in Office scripts.


In VBA macros, I used "+" or "&" to join strings,Office scripts use only "+".

function main(workbook: ExcelScript.Workbook) {
  let s1: string = "ABC";
  let s2: string = "ABC";
  let s3: string = "";

  s3 = s1 + s2;


To combine numbers as strings, use the toString() method to convert numbers to strings.

function main(workbook: ExcelScript.Workbook) {
  let n1: Number = 123;
  let n2: Number = 456;
  let s: string = "";

  s = n1.toString() + n2.toString();


The "+=" is used to join a string of type string on the left-hand side followed by a string on the right-hand side.

For those who want to learn Office scripting effectively

The information on this site is now available in an easy-to-read e-book format for $3.00.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Excel Office Scripts to streamline your workflow.


Office Scripts Articles