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

How to add a full image in excel using a downloadable link from a form

I am trying to upload a picture file response into an excel as a full image not a URL from a form. The form provides me with a downloadable jpg, jpeg or png (if using a file converter) URL. I want to try to take the jpg, jpeg or png file (jpg being…
spec
  • 1
  • 1
0
votes
1 answer

Office Scripts --> For Loop --> Range Error

I am using a for loop to get a range of cells. But when I specify range, it's returning a string. Please help me with this. Also, I have attached an image of the Error. function main(workbook: ExcelScript.Workbook) { for (let i=0; i<=10; i++) { …
kartrabby
  • 1
  • 2
0
votes
1 answer

How to insert images as pictures in excel using the URL of the picture

I am trying to get a full picture to upload onto a worksheet from its url. I have created a form where there is a file upload and I would like for it to show the image rather than a url. Is there a way to do this using office scripts? Thank you!
spec
  • 1
  • 1
0
votes
2 answers

Filling an Array with more than 8 values filles everything with the 9. ( Office Script / Excel Online )

this question relates to Office Script which uses TypeScript and I don't know if its an issues of my none existant coding skills or the Office Skript System. Basically pushing 8 variables to an array works, if I add a 9. the array get's overwritten…
0
votes
2 answers

How to paste the array values to new worksheet at specifice cell

I want to paste array values in desired cells. But I am getting errors in line 23. function main(workbook: ExcelScript.Workbook) { let emp_sheet = workbook.getWorksheet("Emp"); let cc_id_range = emp_sheet.getRange("F1:O17"); let cc_id_values…
kartrabby
  • 1
  • 2
0
votes
2 answers

VBA Range("A1048576").End(xlUp).Row in Javascript Excel API

i'm converting some VBA Macros to Office Script and I've just found this trick: lastRow_in_t = Worksheets("in_t").Range("A1048576").End(xlUp).Row What could be a good start to do this line of code in Typescript/Office Script I have no clue where to…
Teco
  • 5
  • 3
0
votes
1 answer

How to delete a worksheet if it exists and create a new worksheet with the same name with Office Scripts

I have a script that makes a copy of an existing worksheet and generates a table within this new worksheet called Lists. Looking for a way to delete the new worksheet whenever the script runs again, but I keep getting the 'Worksheet activate: The…
nouptime
  • 9,929
  • 5
  • 22
  • 37
0
votes
1 answer

SubString Operation in Office Script

I've just started using Office Scripts in Excel but can't find the right function to do a simple substring operation. The code below isn't working for me but I'd like it to just return the first 3 characters "ABC". let bigString =…
Will Man
  • 1
  • 3
0
votes
1 answer

Import CSV file from Onedrive - Excel Web - Office Script

I would like to create script in order to allow user of file.xlsx stored into Onedrive to import date from file.csv (into same folder of file.xlsx into Onedrive). And then, process these data with other script. Folder X ----- file.xlsx -----…
Babi
  • 11
  • 6
0
votes
2 answers

How to Nest Loop in Excel Script in order to Scan specific Range

i'm converting a VBA Macro to a Excel Script in order to run a macro at Excel Web The VBA Code: //Parameters is a Sheet who has startCol/endCol Cell number and startRow/endRow numbers // Cells 3,4 is startCol; Cells 3,5 is endCol // Cells 3,2 is…
Teco
  • 5
  • 3
0
votes
1 answer

How to convert For loop in VBA to Typescript in a right way

Im trying to convert a Macro VBA to a Office Script(Typescript) to run in Excel Web I have this piece of VBA Code: Sub process() On Error GoTo Error_Handler ' concatenate Macro Dim var As String Dim row As Integer Dim column…
Teco
  • 5
  • 3
0
votes
1 answer

Q: Office Script - Erase data from Column

could you guys lend me a hand I need to convert some VBA code to Office Script and I'm Strugling, i need to erase data from a column with certain parameters here is the code: Sub processing() On Error GoTo Error_Handler ' concatenate…
Teco
  • 5
  • 3
0
votes
2 answers

Sharing Office Online Excel Scripts

I have an Excel script created in my Office Online account. I see where I can share that script with another user per workbook and also where I can share the script with another user as a whole in the manage access section of the .osts file…
0
votes
1 answer

How to delete columns in a table using Office Scripts

I have a table and I'm looking to delete specific columns for further processing via Office Scripts. Also had a look at the API reference but I was not able to find a method to do so. I have ~30 columns in total but would like to remove several…
nouptime
  • 9,929
  • 5
  • 22
  • 37
0
votes
1 answer

Excel Script: Cannot read property 'getRowCount works not with Power Automate

I wrote I simple Excel Script which works online pretty well, but if I use the same Script with Power Automate I get an error. Here ist the Script: function main(workbook: ExcelScript.Workbook) { let sheet = workbook.getActiveWorksheet(); let…