Solved: Power Automate Flow Extract Email Attachment into Doc Library and Update Sharepoint (1 Viewer)

Isaac

Lifelong Learner
Local time
Today, 00:46
Joined
Mar 14, 2017
Messages
4,750
Again, posting this to build up content/traffic in this forum.

We have a enterprise-level, I.T.-built System, from whence can be exported useful reports manually. I wanted to automate the ingestion of one of these XLSX reports for use in an Access database. (Since we have users on different networks, Sharepoint and Email are the main common denominators that provide interconnectedness).

I created a business process + Flow that does the following useful thing:

  1. Convinced the admins of the I.T. system to automatically email this report to a Shared (Office 365) mailbox, each Friday morning
  2. Built a Microsoft Flow that does the following:
    1. Be triggered by an incoming email to the shared mailbox, with certain text in the Subject line
    2. Extract the attachment of the email to a Sharepoint document library, using a variable that will contain a unique file name
    3. Create a new record in a Sharepoint list, telling me the unique filename that was granted to the file, so that at any time I can use MS Access to query that linked Sharepoint list for the most recent entry, and then freely link to the downloaded xlsx file in the Sharepoint doc library for further processing
    4. Move the email to a subfolder of the shared mailbox's Inbox
  3. Write some Access code that can be triggered by a button which determines whether we already have imported the most 'recent' file, and if not, perform further import/processing.
This ETL process was accomplished with the following chained Flow operation steps:
(To make the screenshot information useful, I have left the official Microsoft default name of each Operation as the portion prior to the parenthesis; the parenthesis is the portion I've re-named for my own descriptive purposes)

flow1.jpg

flow2.jpg


flow3.jpg


flow4.jpg


flow5.jpg


After this, I can write Access code as follows:

  1. Code Dlookup to get the FileName in a column of my "already imported" table
  2. Select the top 1 record (by Created, desc) of the Sharepoint list that the Flow creates 1 record in each time it downloads, containing the filename
  3. If the two are the same, we've already imported the most recent one; if not, proceed
  4. Link to the downloaded XLSX in the Sharepoint doc library, i.e.:
    \\company.sharepoint.com@SSL\DavWWWRoot\sites\SPOSiteName\DocLibraryName\" & varFileName
  5. Perform further processing, append/update queries, etc
This resulted in a sound, fully automated, server-hosted ETL job with which I am happy!
 
Last edited:

Users who are viewing this thread

Top Bottom