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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Help with excel script...
Power Automate
Unanswered

Help with excel scripts and power automate for exporting excel charts to a word template

(0) ShareShare
ReportReport
Posted on by 26

Hi Community,

 

I have the following power automate (PA) flow I was able to build following partially the instructions from Awesome! Create Charts via Office Scripts - DamoBird365

Julianveda_0-1713700375072.png

 

I have adapted the excel script to export existing charts in excel (instead of creating them with the script) to a word template. My question will concern the script in the "run script" action and probably also the "compose action".

The script code is the following which comes from the microsoft doc to illustrate the getImage property. I have just adapted it to include a second chart:

 

Julianveda_1-1713700375075.png

 

The PA workflow works very well when a single image is used. However, I have not been able to include the second image in my workflow. I am not expert at coding so I just tested crating 2 "return" as you can see at the end of the previous script, but only the first image is really taken into account in the PA workflow.

The other thing I tested is returning an array :

 

Julianveda_2-1713700375075.png

 

but in this case I get an error when running the PA workflow:

 

Julianveda_3-1713700375076.png

 

I have also tried creating and interface at the end as I have seem in other examples of code in the microsoft doc :

 

Julianveda_4-1713700375076.png

 

but in this case I get another error :

 

Julianveda_5-1713700375077.png

 

Do you know how I can correctly return my two images from my script to then be able to use them in the rest of my PA workflow ?

 

Thanks for any help,

Julian

 

Categories:
I have the same question (0)
  • Manish Solanki Profile Picture
    15,099 Moderator on at

    Hi Julian,

     

    When you are returning object with syntax 

    return { firstimage, secondimage};

    then you also need to modify the return type from the function definition, so modify the first line of the function to return interface 'ReportImages' instead of sting as shown below:

    function main(workbook: ExcelScript.Workbook): ReportImages {

     

    Pls retest the flow after making the changes.

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 239 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 177 Super User 2026 Season 1

#3
Kalathiya Profile Picture

Kalathiya 97 Super User 2026 Season 1

Last 30 days Overall leaderboard