Reputation: 6180
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 creating an excel instance locally?
async function main(context: Excel.RequestContext) {
// Set range A1 on selectedSheet
let workbook = context.workbook;
let worksheets = workbook.worksheets;
let selectedSheet = worksheets.getActiveWorksheet();
selectedSheet.getRange("A1").values = [
["Hello World"]
];
}
I could not find any graph api to do so.
Thanks.
Upvotes: 0
Views: 3314
Reputation: 1571
Microsoft has announced the Office Scripts integration with Microsoft Power Automate (preview), where you can run your Office Scripts with schedule-based triggers or event-based triggers.
Here are a few links that might be helpful:
Upvotes: 2
Reputation: 46
To run office script via Graph API, there would be two requirements: 1. Office JS library: parse the office script to build the request and also parse the result in response. 2. Specific Graph API: run the request in service side against the target file.
Unfortunately, none of them is availabe now.
However, there is another ongoing work to integrate Office Scripts with PowerAutomate, which will enable us to run the scripts against a workbook on PowerAutomate (without a local Excel instance). Here (https://mybuild.microsoft.com/sessions/bc1bc3e6-9dc1-474e-a5d6-409af2fa0ad3?source=sessions) is the video to introduce Office Scripts (and also its integration with PowerAutomate) in recent Microsoft Build. This feature would be in public preview soon.
Upvotes: 2