cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Add image in to excel table from base64

Hi,

Scenario

SPO list "Covid19_Compliance" has 3 column names 'PayLoad01', 'PayLoad02', 'PayLoad03'.

The data in these columns contains stringified JSON of user inputs which includes Texts, Camera captured images(base64).

SPO list is updated from PowerApps.

 

The Problem:

I am able to add all data from those columns into excel tables using Parse JSON & Excel Business connector.

But I am unaware how to add base64 encoded images into cell of excel table.

Also suggest me if I need to make changes at PowerApps level, like some alternatives instead of converting images to base64.

I need help 🙏

2 ACCEPTED SOLUTIONS

Accepted Solutions
ChristianAbata
Most Valuable Professional
Most Valuable Professional

@Anonymous  thanks my friend, it's a pleasure to help here.

 


@Anonymous wrote:

The need is to insert image in excel's Image(Optional) column. This is required.

 



It's a shame but unfortunally we can't do this with PA this is not supported yet.

 

And to answe your second question see it's in profile setting

ignature.PNG

 

I don't know if this is available for all users but is there jejeje



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me:
Youtube: Christian Abata
Facebook: Power Automate LA
Website Tutorials: Christian Abata

View solution in original post

Hey friends,

 

Wondering if you'd like to try out the new "Run script" action of Excel Online (Business), where you can actually run Office Scripts to:

  • Retrieve images from Excel as base64 encoded content then pass to the next action in Power Automate
  • Or pass in some base64 encoded image content to create an image in Excel

 

For example, this is an action to add an image (encoded in base64) to cell "E8" on "Sheet1" in Excel:

flow-run-script-add-image.png

 

 

You'll need to first create the "Add image" script in Excel Online. Here is one sample script that can be used here:

 

function main(workbook: ExcelScript.Workbook, sheetName: string, address: string, base64ImageString: string) {
  let sheet = workbook.getWorksheet(sheetName);
  let range = sheet.getRange(address);
  let image = sheet.addImage(base64ImageString);
  image.setTop(range.getTop());
  image.setLeft(range.getLeft());
}

 

 

Here are a few links that might be helpful to learn more about the new Run script action and Office Scripts:

 

And a few Office Scripts APIs that might be helpful here:

 

Hope this helps!

Yutao

View solution in original post

18 REPLIES 18
fchopo
Super User
Super User

Hello @Anonymous 

Could you try to convert your base64 image to binary and send it to excel by using dataUriToBinary() function?

Have a look at this thread: https://powerusers.microsoft.com/t5/Building-Power-Apps/PowerApps-to-Flow-DataURIToBinary/td-p/156177

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Anonymous
Not applicable

Hi @fchopo ,

I have tried with the reference article you mentioned but it is giving following error-Excel Connector

 

InvalidTemplate. Unable to process template language expressions in action 'Add_a_row_into_a_table' inputs at line '1' and column '2784': 'The template language function 'dataUriToBinary' expects one parameter: the data URI that is to be converted to binary. The function was invoked with '0' parameters. Please see https://aka.ms/logicexpressions#dataUriToBinary for usage details.'.

 

 

 The function is

 

dataUriToBinary(items('Apply_to_each')['p5'])

 

Anonymous
Not applicable

With the help of JSON parse connector, successfully converted image data URI to binary and updated in cell of table.

But in cell it shows something like ?PNG

So should I conclude that images can't be inserted to excel via flows.

Anonymous
Not applicable

@ChristianAbata Hi, Can you help in this regard?

ChristianAbata
Most Valuable Professional
Most Valuable Professional

hi @Anonymous  shure. 

 

So if you want something like this

make.PNG

 

I'm afraid my friend is not possible with PA, because and image is not part of a excel row, and image is like a frame inside excel, and until today this is not suppported by PA.

 

Another scenario is this

this.PNG

 

inserting data in base64 into excel to use it in Power Apps and show images by reading the data in excel.

Please let me know what scenario you are needing.



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me:
Youtube: Christian Abata
Facebook: Power Automate LA
Website Tutorials: Christian Abata
Anonymous
Not applicable

@ChristianAbata 

First of all I would like to congratulate you for being elevated as Super User 🎉🎉🎉

 

When user fills and submits information from PowerApps, a new item will be created in SPO list.

Then a flow will be triggered which will first parse JSON from PayLoad1, PayLoad2, PayLoad3 of SPO list item.

Then excel's Add Rows connector will fill up three tables from above data in a existing excel templete.

Excel sheet has 3 Tables(Table1,Table2,Table3).

 

All 3 tables' column names are same- SrNo, Area, Point, Status, Remark, Image(Optional). (Total 6 columns & 3 tables)

Then an email will be sent attaching that excel file to preset user email addresses.

After that all rows from all 3 tables will be deleted using another excel connector.(To make it ready for future flow trigger as a template).

Everything is running fine except image inserting issue in excel excel sheet table.

 

The need is to insert image in excel's Image(Optional) column. This is required.

 

(Off the topic question: How can I create my signature so that it added automatically when creating/replying to a post in this community forum? just like like outlook has that feature)

 

 

Best Regards,

Ankit Shah

Surat-India

Twitter: https://twitter.com/AnkitShah55

ChristianAbata
Most Valuable Professional
Most Valuable Professional

@Anonymous  thanks my friend, it's a pleasure to help here.

 


@Anonymous wrote:

The need is to insert image in excel's Image(Optional) column. This is required.

 



It's a shame but unfortunally we can't do this with PA this is not supported yet.

 

And to answe your second question see it's in profile setting

ignature.PNG

 

I don't know if this is available for all users but is there jejeje



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me:
Youtube: Christian Abata
Facebook: Power Automate LA
Website Tutorials: Christian Abata
Anonymous
Not applicable

@ChristianAbata 

Thanks friend for clarifying that, now I have no doubts and I can move forward.

What I am thinking to create a zip file containing that excel file and image files.

Every image file name will be copied to ImageName column in excel table.

 

Is this good practice? Or if you have idea?

(PS: I am convincing my senior to generate reports in PDF instead of excel, I can do it by using HTML)

ChristianAbata
Most Valuable Professional
Most Valuable Professional

@Anonymous  excellent way my friend. You can create .rar file and then in excel add the url to that file.

 

Pd: If you can convince your superior to use pdf is better, because as you said you can use HTML, I don't know if you saw this video but I give you anyway https://www.youtube.com/watch?v=2rfAQe1kK8M, is a Shane Video



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me:
Youtube: Christian Abata
Facebook: Power Automate LA
Website Tutorials: Christian Abata
Anonymous
Not applicable

@ChristianAbata Yes I have watched that video, in fact I follow all videos and updates from Shane, (He is like a guru)

Well, Thanks for all help friend 👋

ChristianAbata
Most Valuable Professional
Most Valuable Professional

@Anonymous  you are welcome my friend. Please consider to mark an answer as solutions to guide other over your question 😉



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me:
Youtube: Christian Abata
Facebook: Power Automate LA
Website Tutorials: Christian Abata

Hey friends,

 

Wondering if you'd like to try out the new "Run script" action of Excel Online (Business), where you can actually run Office Scripts to:

  • Retrieve images from Excel as base64 encoded content then pass to the next action in Power Automate
  • Or pass in some base64 encoded image content to create an image in Excel

 

For example, this is an action to add an image (encoded in base64) to cell "E8" on "Sheet1" in Excel:

flow-run-script-add-image.png

 

 

You'll need to first create the "Add image" script in Excel Online. Here is one sample script that can be used here:

 

function main(workbook: ExcelScript.Workbook, sheetName: string, address: string, base64ImageString: string) {
  let sheet = workbook.getWorksheet(sheetName);
  let range = sheet.getRange(address);
  let image = sheet.addImage(base64ImageString);
  image.setTop(range.getTop());
  image.setLeft(range.getLeft());
}

 

 

Here are a few links that might be helpful to learn more about the new Run script action and Office Scripts:

 

And a few Office Scripts APIs that might be helpful here:

 

Hope this helps!

Yutao

Ganeshkumar_R
Frequent Visitor

Guys,

 

Can you explain how we can add in this below format

Ganeshkumar_R_0-1610367274775.png

@ChristianAbata  - Need to take the SharePoint attachment content and add that in excel table which is in OneDrive. I can able to take the attachment content using get attachment and get attachment content action from SharePoint. By passing the value to Update Row action is not working. Can anyone help this out it emergency 

 

Thanks

Hi @Yutao ,

This is not working for me, I get the following error:flow.png

 

This is the excel file: 

excel.png

 

Any ideas about what could be wrong?

 

Thanks in advance,

Eugenio.

Eulopezp
Frequent Visitor

The problem was solved, it is needed to remove the "data:image/jpeg;base64,".

This is a very common problem in Power Apps, just in case someone get it 🙂

@Eulopezp @Yutao 

The script works great and images are show in excel. However the images are not aligned in the excel rows and they overlapped over other. How do I fit the images in the column designated for the image. Is it even possible to fit in the image in the cell of image column?

RameshMukka_0-1694842914465.png

 

Yutao
Employee
Employee

@RameshMukka - to properly align an image to a range, you will need to specify the image's top, left, width, and height to match with the respective top, left, width, and height of the target range.

 

For example, in order to achieve the same result in this screenshot:

Yutao_0-1695918409097.png

 

You can write your script like this:

function main(workbook: ExcelScript.Workbook) {
  const base64ImageString1 = "iVBORw0KGgoAAAANSU...";
  const base64ImageString2 = "iVBORw0KGgoAAAANSU...";
  const sheet = workbook.getWorksheet("Sheet6");
  const range1 = sheet.getRange("B2");
  const image1 = sheet.addImage(base64ImageString1);
  image1.setTop(range1.getTop());
  image1.setLeft(range1.getLeft());
  image1.setWidth(range1.getWidth());
  image1.setHeight(range1.getHeight());
  image1.setPlacement(ExcelScript.Placement.twoCell);

  const range2 = sheet.getRange("B4:E6");
  const image2 = sheet.addImage(base64ImageString2);
  image2.setTop(range2.getTop());
  image2.setLeft(range2.getLeft());
  image2.setWidth(range2.getWidth());
  image2.setHeight(range2.getHeight());
  image2.setPlacement(ExcelScript.Placement.twoCell);
}

 

Using `ExcelScript.Placement.twoCell` can make sure Excel will automatically move and resize an image when you move and resize the range below it.

LucaNeedHelp
Helper III
Helper III

Hello, i get always a new image from the MS Forms in my OneDrive. Is it possible to get this images also in the excel? 

Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Users online (7,013)