OfficeScripts

  • All Post
  • .NET
  • All
  • Apps Script
  • Java
  • OfficeScripts
  • Others
  • Python
  • SQL
  • VBA

May 10, 2023/

Here’s an example of an OfficeScript that loops through the items or cells in a selected range: function main(worksheet: ExcelScript.Worksheet, rangeAddress: string) { // Get the selected range let selectedRange = worksheet.getRange(rangeAddress); // Get the values in the range let rangeValues = selectedRange.getValues(); // Loop…

May 10, 2023/

Here’s an example of an OfficeScript that makes an API POST request to a dummy JSON API site and prints the response status in the console:   function main() { // Define the request payload let payload = { title: "OfficeScripts", body: "Making API requests",…

May 10, 2023/

Here’s an example of an OfficeScript that makes an API GET request to a dummy JSON API site and prints the values to an Excel range: function main(worksheet: ExcelScript.Worksheet) { // Make the API GET request let response = await fetch(‘https://jsonplaceholder.typicode.com/posts’); // Parse the response…

May 10, 2023/

Here’s an example of an OfficeScript that creates a pivot table using the range A1:Z200 in Sheet1 and adds sample rows, columns, and values to the pivot: function main(workbook: ExcelScript.Workbook) { // Get the source sheet and range let sourceSheet = workbook.getWorksheet("Sheet1"); let sourceRange =…

May 10, 2023/

Here’s an example of an OfficeScript that copies data from one sheet and pastes it into a new row in another sheet, dynamically finding the new row using the last used range:   function main(workbook: ExcelScript.Workbook, sourceSheetName: string, targetSheetName: string) { // Get the source…

May 10, 2023/

Here’s an example of an OfficeScript that copies data from one sheet to another in the same workbook: function main(workbook: ExcelScript.Workbook, sourceSheetName: string, targetSheetName: string) { // Get the source and target sheets let sourceSheet = workbook.getWorksheet(sourceSheetName); let targetSheet = workbook.getWorksheet(targetSheetName); // Get the used…

May 10, 2023/

Here’s an example of an OfficeScript that adds a chart to a worksheet in an existing workbook: function main(worksheet: ExcelScript.Worksheet) { // Define the range of data for the chart let dataRange = worksheet.getRange("A1:B5"); // Add a chart to the worksheet let chart = worksheet.addChart(ExcelScript.ChartType.ColumnClustered,…

May 10, 2023/

Here’s an example of an OfficeScript that adds data to a range in an existing worksheet: function main(worksheet: ExcelScript.Worksheet) { // Define the range where you want to add data let range = worksheet.getRange("A1:C3"); // Define the data to add let data = [ ["Value…

May 10, 2023/

Here’s an example of an OfficeScript that creates a copy of the current sheet in an existing workbook: function main(workbook: ExcelScript.Workbook, sheetName: string) { // Get the active sheet let activeSheet = workbook.getWorksheet(sheetName); // Create a copy of the active sheet let newSheet = activeSheet.copy();…

May 10, 2023/

Here’s an example of an OfficeScript that creates a new sheet in an existing workbook: function main(workbook: ExcelScript.Workbook) { // Create a new sheet let newSheet = workbook.addWorksheet(); // Rename the new sheet newSheet.setName("NewSheet"); } To use this OfficeScript, follow these steps: Open Excel Online…

Load More

End of Content.

Pamai Tech
Turning ideas into Reality

Products

Office Add-in

Enterprise Solutions

Cloud Consulting

UI UX Design

Data Transformation

Services

FAQ's

Privacy Policy

Terms & Condition

Team

Contact Us

Company

About Us

Services

Features

Our Pricing

Latest News

© 2025 Pamai Tech