Notifications
Announcements
Hi All,
Could anyone lecture me on how to clear objects(image) in an excel file with flow?
I looked for a way to run the excel script which ended up no success.
Any advise will be so much appreciated.
Thanks,
Hi @KenJapan
Write a macro in the Excel file and then call it from PA.
This macro will delete all images from all worksheets - here's an example excel file with the macro in it.
Sub Delete_All_Images_In_Workbook() For Each ws In ActiveWorkbook.Worksheets For Each img In ws.Pictures img.Delete Next img Next ws End Sub
Regards
Phil
Thanks for the tip, but I couldn't find 'launch excel' or 'run macro' connector in the flow....
@KenJapan - The above solution is provided for Power Automate Desktop not Power Automate Cloud, so you will not find those activities in Power Automate Cloud.
Understood. Any idea for the PA cloud??
To do the same thing 'in the cloud' you can use this Office Script in your Excel file. In Excel Online, go to the Automate tab -> New Script and paste this in. Give the script a name and save it.
function main(workbook: ExcelScript.Workbook) { let sheets = workbook.getWorksheets(); for (let sheet of sheets) { sheet.getShapes().forEach((shape, index) => { if (shape.getType() === ExcelScript.ShapeType.image) { shape.delete(); } }); } }
Here's my example flow. I called the script Delete_All_Images
I've tested this code and it works.
regards
It worked! Thank you sooo much!
Love the community😀
Hi,
I was searching for a way to remove objects from excel files.
Found this discussion and tried but it does not work.
Maybe it's because of a different object...
My objects see picture
Maybe anyone can help me out
Thanks a lot.
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 522 Super User 2025 Season 2
Tomac 364 Moderator
abm abm 243 Most Valuable Professional