web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Running Office Script ...
Power Automate
Suggested Answer

Running Office Script from excel is not triggering flow in Power Automate to draft outlook email

(0) ShareShare
ReportReport
Posted on by 4
Hi everyone,
 
This is my first time using Excel Office script and Power Automate.
 
On my Excel, I have created a simple script to draft an outlook email:
 
function main(workbook: ExcelScript.Workbook):myOutput {

    let ws1 = workbook.getWorksheet("1st Batch 5pm"); 
    let ws2 = workbook.getWorksheet("2nd Batch 11pm)"); 
    let scriptws = workbook.getWorksheet("SendEmail"); 

    let emailto = scriptws.getRange("I1").getText();
    let cc = scriptws.getRange("I2").getText();
    let client = ws1.getRange("I2").getText();
    let date = ws1.getRange("I3").getText();
    let reason = ws1.getRange("I3").getText();
    let subject = "Late block " + date + " | Client limits for " + client;

    //console.log(ws1.getName());

    return {emailto, cc, subject};
}

interface myOutput{
    emailto: string;
    cc: string;
    subject: string;
}
 
And in my Power Automate, I setup the flow.
1) Manually Trigger a flow
2) Run script
3) Draft an email message
 
When I TEST the flow, I am able to receive a draft with the expected value on my outlook.
 
However when I run the script from excel, it says "script run successfully", but I don't find any email drafted.
 
Why is the flow not triggered when I press the button?
 
I really appreciate if someone can point me to the mistake I am having.
Screenshots are attached.
 
Thank you,
WK
 
6 Draft Sample.png
1 Office Script w...
2 Power Flow.png

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Categories:
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    7,431 Super User 2026 Season 1 on at
     
    Your worksheet name has a bracket typo: let ws2 = workbook.getWorksheet("2nd Batch 11pm)");

    If the real sheet is 2nd Batch 11pm (without )), this can break when you expand script later.

    Testing the flow works (because the flow runs “Run script → Draft email”) and Clicking Run Script in Excel says “success” but no email draft appears (because Excel isn’t calling the flow) - https://learn.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration?tabs=run-script

    ✅If this helped, please Accept as Solution to help others ❤️ A Like is appreciated 🏷️ Tag @MS.Ragavendar for follow-ups.

     
     
  • WT-02041500-0 Profile Picture
    4 on at
    Hi Ragavendar,
     
    Thank you for spotting the error.
     
    I read the link but I still have trouble understanding why the Excel is not calling the flow...
    i wish there is some log to say maybe it is permission issue??
     
    I read somewhere that maybe for the Trigger, use "For a selected row", but my button could be anywhere and I am not using table.
     
    Thank you
  • WT-02041500-0 Profile Picture
    4 on at
    Hi,
     
    So what I did was to change the Trigger to "For a selected row", and added a Table (which doesn't do anything) in the excel.
     
    Then from Excel, I click Automation Templates > Flows in this workbook > more commands > Run.
    This time I was able to see the Draft in my outlook.
     
    Having a button still does nothing, unfortunately.
     
    7 For a selected ...

    Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard