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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Assistance with Automa...
Power Automate
Answered

Assistance with Automating Email Attachment Processing via Power Automate

(1) ShareShare
ReportReport
Posted on by 25

Hi,

 

I need help setting up a Power Automate flow with the following requirements:

 

Trigger: When a new email arrives with attachments (specifically PDFs).

 

Save Attachments: Automatically save the PDF attachments to a specific OneDrive folder.

 

AI Processing: Use the PDFs as input for a ChatGPT prompt (or an OpenAI action if available).

 

Response Handling: Capture ChatGPT's output and send it as an email response to the original sender or a specified recipient.


     

I would appreciate guidance or an example flow that could help me accomplish this.

Let me know if any connectors, licenses, or APIs are required beyond standard Power Automate and OneDrive.

 

Thank you!

I have the same question (0)
  • Sam_Fawzi Profile Picture
    750 Super User 2025 Season 2 on at
    Hey @
     
     
    I'd be happy to help you set up your Power Automate flow. Before we proceed, I have a few questions to better understand your requirements:
    • Attachment Types: Are the PDFs invoices, legal documents, or another type? 
    • Volume: How many emails with attachments do you expect to process regularly?
    • Response Handling: Do you want to send the ChatGPT output as an email response to the original sender, or is there a specific recipient you have in mind?
    • Attachment Details: How many pages do you expect in each PDF attachment? Are they typically in the same format, or do they vary by sender?
    Additionally, please note that using OpenAI's API for processing will require an API key, and ensure you have the necessary licenses for Power Automate and OneDrive.
    Looking forward to your response!
  • Verified answer
    Riyaz_riz11 Profile Picture
    3,876 Super User 2025 Season 2 on at
    Hi,
     

    Create the Flow

    • Go to Power Automate.

    • New Automated Cloud Flow.

    • Trigger:

      • When a new email arrives (V3)

      • Configure:

        • Choose the mailbox.

        • Optionally set filters (e.g., From, Subject Contains).

     

     Get Attachments

    • Add Action:

      • Get Attachment (Outlook)

    • This requires:

      • Message Id = Message Id from the trigger.

      • Attachment Id = Attachment Id (from a loop).

    Tip: Use an Apply to Each over Attachments.

     Filter Only PDFs

    Inside the loop:

    • Condition:

      • Attachment Name ends with .pdf

    Example:

    endsWith(items('Apply_to_each_Attachment')?['Name'], '.pdf')
     

    If Yes: proceed

    If No: skip

    Save PDF to OneDrive

    Action:

    • Create File (OneDrive)

      • Folder Path = Your target folder.

      • File Name = Attachment Name.

      • File Content = ContentBytes from Get Attachment 

     This creates a physical file in OneDrive.

     

     Extract PDF Text

    How to do this?

    Option A: AI Builder Read (No Code)

    • Use AI Builder: Extract text from PDF

      • If you have the license, it works out of the box.

      Send Text to ChatGPT 

    If you have Azure OpenAI or OpenAI connector, add:

    Action:

    • Create Completion

      • Model: gpt-3.5-turbo or gpt-4

      • Prompt: e.g.,

        lease analyze this document and summarize the key points:

        [Your extracted text here
         

     Capture the AI response.

     Send Email with AI Response

    Action:

    • Send an email (V2)

      • To: From (original sender) or any recipient.

      • Subject: e.g.,

        Summary of your attachment: [Original Subject]

      • Body:

        ere is the AI-generated summary of your PDF:

        [AI Response Text]
         
         
         
        If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
        Regards,
        Riyaz
         
         
         

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard