Office Scripts

Office Scripts allow you to record your actions and generate the corresponding TypeScript code to allow the actions to be automated.
Office Scripts / Automate Tab is only available in Office on the Web, not Desktop.
Once this feature has been enabled within the Office 365 environment you will see an additional Automate tab appear at the top.

alt text

TypeScript

TypeScript = JavaScript + Type Definitions
TypeScript adds additional syntax to JavaScript to support data types, variables, functions etc.
link - typescriptlang.org

alt text

Main Function

The main function is the entry point for a script.
The workbook argument represents the Excel file and must be included in this main function.

function main(workbook: ExcelScript.Workbook) { 
   const sheet = workbook.getWorksheet('Sheet1');
   if (sheet) {
      sheet.setName('BETTER');
      sheet.setPosition(0);
   }
}

Script Lab Add-in

This is a FREE Microsoft add-in that helps you create, run and share your TypeScript code.
It can be installed from the Microsoft Office App Store.
Script Lab is available on Desktop (Windows + Mac) and in Office on the Web.

alt text

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopNext