Microsoft Flow – Custom Connectors – How to read an Excel file from SharePoint?

A while back I wrote a post about reading Excel files stored in SharePoint using Microsoft Graph. This has been a post that has been helpful to many people so why hasn’t this been turned into a custom connector?

Do you remember the reasons for a custom connector?

  1. Flow doesn’t support something yet.
  2. Flow supports something but ti can be done better!

Well, I added the reading of excel files to my MS Graph Connector on GitHub!

Custom connector to read Excel file from SharePoint

Simply download the latest version of the MS Graph Connector. Next to the Get My Profile action that I added last week there are now 3 action available to replicate the steps in my earlier MS Graph post.

Then upload the swagger file to Microsoft Flow.

Create the following actions:

  • Get Site ID
  • Get Lists in Site
  • Read Excel file from SharePoint Library

Get the site details

We start by getting the Site ID. Simply supply your tenant name and the site that contains the Excel file that needs to be read. My site is pieterveenstramvp/sites/FinanceDemo

Get the site ID

Then I’m getting all the lists using the site id. The site is is set to @{body(‘Get_Site_ID’)[‘id’]}

 

Get the lists and libraries

Get lists and libraries form SharePoint

Then I’m using the compose action to make it easier to get to my list data. the value is set to

@{body(‘Get_Lists_in_Site’)[‘value’]}

Compose to get the result

Read the Excel file

Then finally, I’m using the output from the compose and I’m selecting just the invoice library. Yes, this could be done a bit more efficiently, but that is somthing for the future.

Reading the excel file with a custom connector in Flow

Now finally I’m reading the excel file by supplying the filename, name of the sheet and the range for my data.

  • No locks on the excel spreadsheet while I develop the solution, like the standard connector does.
  • No need to use data tables in Excel.
  • On top of that it is extremely fast, compared to the standard connector.

I will soon create an updated version to improve the filtering options. , unless of course you beat me to it. Feel free to suggest the code changes on the GitHub site.

 

22 thoughts on “Microsoft Flow – Custom Connectors – How to read an Excel file from SharePoint?

  1. Read Excel from SharePoint library is not giving me the “ID” options that you used here. I only see “Body”. Did I missed something ? Please help.

  2. Hi, I ran into the issue of the default flow action to be too slow. I tried recreating the steps, but when testing the custom connector, I receive the message that the app is not registered as a multi-tenant application.

    When I go into the app registration and change it to “Accounts in any organizational directory”, I can get to the login screen, but it then asks me to login with an admin account.
    Logging in with the admin account gets me a “account unknown”-message. Thanks

  3. Hi every i have an error in my api when add this connector or Swagger code in my api definition i have error when i click button try this operation the error is that ” Object is missing the required property ‘accept'”.

      1. Can you share with me the code of function which helps to crate this api defination

  4. Hi,

    We are getting 404 error on all actions and when we download error details on Get Profile ID it shows

    {“host”:{“api”:{“runtimeUrl”:”https://flow-apim-europe-001-northeurope-01.azure-apim.net/apim/read.20excel.20file.5ff6fe3c3c36af320c.5ff35285b5326983de”},”connection”:{“name”:”/providers/Microsoft.PowerApps/apis/shared_read.20excel.20file.5ff6fe3c3c36af320c.5ff35285b5326983de/connections/35c280861e11458cb97e08369e54daf5″}},”method”:”get”,”path”:”/v1.0/me”,”headers”:{“Content-Type”:”application/json”},”authentication”:{“value”:”*sanitized*”,”type”:”Raw”}}

    Your quick response in this regard will highly appreciated.

    Regards.

  5. Hi Pieter,

    What if I don’t know the range of my data like A1:J10? How do I figure out the exact number of rows?

  6. if there are connections within the Excel file to other files can flow be used to refresh that connection

  7. While using update a row action for excel online in Ms flow there is a value items which takes dynamic values.
    In what format does it accepts values if I have to update selectes columns of a row?

  8. Hello Peiter

    thanks for posting this article .

    just assume that there will be excel file received every day and user will upload into sharepoint library then flow can be triggered to process that data into SP list . but these files wont have fixed number of rows of data(but columns are static) , in this case how can I set the excel range dynamically ?so this solution wont work right ?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: