Questions tagged [office-scripts]

Office Scripts is a feature that allows you to automate tasks in Microsoft Office using TypeScript. Currently, this feature is only supported in Excel. Use this tag to ask programming questions about Office Scripts, and consider adding the related tags Excel and TypeScript where relevant.

Office Scripts is a feature that allows you to automate tasks in Microsoft Office using TypeScript.

Currently, this feature is only supported in Excel.

Office Scripts can be created either by using a macro recorder, or by manually writing the script.

Office Scripts contrast themselves from VBA by being usable in Office Online, being primarily asynchronous (while VBA is nearly always synchronous), and lacking support for events. Office Scripts also cannot work with local files and programs.

The documentation is available here: https://learn.microsoft.com/en-us/office/dev/scripts/

Office Scripts use a subset of the Excel JavaScript API, the documentation for that can be found here: https://learn.microsoft.com/en-us/office/dev/add-ins/reference/overview/excel-add-ins-reference-overview

314 questions
0
votes
1 answer

Working with Excel data not in table format

Scenario, Email received with Excel file (.xls) attached, file contains data (Sheet1) that is not formatted as a table. Q: Is there some way using Power Automate to run a script against it to apply transforms? Ideal outcome would be: Excel file…
0
votes
1 answer

Call Office script from outside of MS Excel WebApp

In the Excel WebApp (Office 365) it is possible to place Office Scripts via the "Automate" tab, which is using the JavaScript-syntax and which could automate excel like a VBA-macro, but for the excel WebApp (Screenshot). (How) is it possible to…
Peter
  • 323
  • 4
  • 15
0
votes
1 answer

Problem when specifying Excel file in Execute Office Scripts action

I'm trying to run a flow with Office Scripts on Excel file red from Sharepoint document library. Office Script works perfectly when I manually execute it on statically selected Excel file. However, when I set a dynamic file value from sharepoint…
0
votes
1 answer

Issues with function context in Office Scripts

I am having an issue calling a function into the main script whilst maintaining the excel context async function main(context: Excel.RequestContext){ findMD(1) } The function findMD(test) contains various ranges which draw from context.workbook and…
Jai Hirani
  • 99
  • 9
0
votes
2 answers

How to execute microsoft excel office script programmatically?

We have been moving towards writing office scripts instead of VBA macros. I am also aware of the Microsoft Graph REST APIs for excel. Can someone guide me how can I execute an office script (like a sample one below) programmatically without…
Andy Dufresne
  • 6,022
  • 7
  • 63
  • 113
-1
votes
1 answer

Chat GPT API Key Troubleshooting

I'm currently trying to make a dashboard in excel that allows me to utilize Chat GPT for answering basic excel questions for co-workers. The problem it keeps returning says that I'm out of usage with API Key that I have from Chat GPT API, but I do…
-1
votes
1 answer

Split multivalues in the same column in Office Script

I have following table in Excel. I would like to split the values in the column Product only based on delimiters comma, semicolon or pipe. The code is working but that it splits just multi values in the cells and copies them in the same column with…
Pato
  • 153
  • 6
-1
votes
2 answers

Office Scripts (Sum Cells By Color)

I'm trying convert one code that it make a sum of cells by color in VBA, but i need to use the same code or action from code in Office Scripts, i dont know how is the structure in this plataform, maybe, can you help me to do it? the code in VBA is…
-1
votes
1 answer

Office Scripts: class constructor() does not work

i'm trying to use class on Office Scripts (Excel Online). constructor() produces "Unexpected strict mode reserved word". could someone help me? function main(workbook: ExcelScript.Workbook) { class Foo{ constructor(){ …
-1
votes
2 answers

Parse file content to Office Script

There is possible send string or object as a parameter to office script online, Any idea how to send only data, eg. another excel table with data, maybe some array? hint: there is a action in Power Automate, which return "File Content", which is…
-1
votes
1 answer

Automating a script in microsoft flow for excel to open hyperlinks

First off, I am new to this all. I have a macro which will open all of the hyperlinks I have in an excel file, but I would like to automate the process in microsoft flow/power automate. I am not sure how to convert this to where it will work in…
-1
votes
1 answer

I need help converting legacy async script to current API model

About TypeScript and Converting legacy async scripts to the current model I am trying to convert an async script to the current model, but I am unable to determine a part of the code: async function main(context: Excel.RequestContext) { var sheets =…
-2
votes
1 answer

Converting Range to Array of Cell Addresses Office Script

I'm trying to work out how I can convert a selected range in to a list of selected cells. So far, I have the following code: workbook.getWorksheet("Sheet1").activate(); var range = workbook.getSelectedRanges().getAddress(); …
-2
votes
1 answer

Run Excel Web Office Script when worksheet opens

Is it possible to invoke office script when user opens worksheet? Thanks, Praveen Kumar P
1 2 3
20
21