cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
datalyn
Frequent Visitor

Saving Excel files from emails?

I'm trying to write a flow to save Excel files that are sent as email attachments to a SharePoint folder. Excel files are being saved, emails where there are no excel files included are rejected, but my problem is that I can't seem to exclude other types of files included alongside an Excel file in an email, e.g. if there's an image in the email signature, that's being saved too.

8 REPLIES 8
DeepakS
Resident Rockstar
Resident Rockstar

Hi @datalyn 

 

You should use a condition on file extension before saving it SP folder if it xlx or xlsx. let me know if you need help  to create the condition.

 

Regards,
DS 

datalyn
Frequent Visitor

Hi @DeepakS  

That's what I've been trying to do. I'm using 

@endswith(items('Apply_to_each_2')?['name'], '.xlsx')

 but I can't work out how to make the next step, 'create file in SharePoint', apply only to those files that meet that criteria. At the moment if the condition is met its saving all the attachments in the email.

DeepakS
Resident Rockstar
Resident Rockstar

Hi @datalyn 

 

If i understood you  correctly you are getting multiple files in single email? can you share a screen of you flow?

 

Regards,

DS

datalyn
Frequent Visitor

 

Untitled.png

 

@DeepakS 

Yes, sometimes multiple Excel files, sometimes just one Excel file but also other attachments like images in the email signature for example.

DeepakS
Resident Rockstar
Resident Rockstar

Hi @datalyn 

 

Here is an example that i would suggest to use , i would use split function to get the type and compare it :

split(items('Apply_to_each')?['name'],'.')[1]
EmailAttch.jpg
 
Reagrds,
DS
datalyn
Frequent Visitor

That produces the error message - 

"The power flow's logic app flow template was invalid. The property 'expression' 'split(items('Apply_to_each')?['name'],'.')[1]' of template action 'Condition' at line '1' and column '520' is not a valid template language expression."
 
Also is there a way to add a condition based on a cell value within an attached Excel file?
 
Thanks for your help @DeepakS 
DeepakS
Resident Rockstar
Resident Rockstar

Hi @datalyn 

 

you should use the "apply to each" loop name as per your flow, based on your screen you should use:

split(items('Apply_to_each_2')?['name'],'.')[1]

 

You need to upload the excel first to one-drive or share point than access to read the cell value. i dont think you can read it same flow. 

 

Regards,
DS

 

datalyn
Frequent Visitor

Hi @DeepakS 

 

"The power flow's logic app flow template was invalid. The property 'expression' 'split(items('Apply_to_each_2')?['name'],'.')[1]' of template action 'Condition' at line '1' and column '520' is not a valid template language expression."

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,217)