How to Export SharePoint List to Excel and Send an Email Using Power Automate?

Last week, I worked on a Power Automate scenario where I needed to export the TS MGMT Meeting SharePoint list to Excel and email it to the manager. The goal was to export all SharePoint items to Excel and then send an email with the Excel file as an attachment.

In this tutorial, I will explain how to export SharePoint List to Excel and send an email using Power Automate.

Export SharePoint List to Excel and Send an Email Using Power Automate

Before creating the flow, we need to create a SharePoint list. Here, I created a SharePoint list with the following columns and data types:

ColumnData Types
TitleSingle line of text
StatusChoice
Initial Email DateDate and time
1st Reminder DateDate and time
CategoryChoice
Due DateDate and time
Email AddresseesSingel line of text
power automate export sharepoint list to excel and email

Also, create a blank Excel file in your SharePoint document library, as shown below.

power automate create excel file from sharepoint list and send email

Now follow the below steps:

1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

power automate export sharepoint list to excel

2. Now choose a Get file content action for SharePoint Connector and configure the required parameters:

  • Site Address: Select the SharePoint site address from the dropdown where we create the blank Excel file.
  • File Identifier: Choose the Excel file we created before.
power automate export email to sharepoint

3. Then save the flow and test it. After the flow runs, copy the body of the “Get file content” action.

microsoft flow save email to sharepoint

4. Then, edit the flow and add a Compose action. In the input field of the Compose action, paste the body of the Get file content action.

export sharepoint list to excel power automate

After that, delete the Get file content action and the blank Excel file from your document library.

5. Next, add a Get items action to retrieve all items present in the SharePoint list and provide the following parameters:

  • Site Address: Select the SharePoint site address.
  • List Name: Select the name of the SharePoint list you want to retrieve items from.
Power Automate sharepoint export to excel

6. Now, add an action to store Excel files in a SharePoint library. Click the + icon to add the Create file action (under the SharePoint connector) and provide the required parameters:

  • Site Address: Select the SharePoint site address from the dropdown menu where you store all your Excel files.
  • Folder Path: Select the folder path.
  • File Name: Provide the Excel file name with the .xlsx extension. Here, use the SharePoint ID column from dynamic content.
  • File Content: Use the dynamic content Output from the Compose action.
how to export sharepoint list to excel using power automate

7. Now, let’s create an Excel table. Click the + icon to add the Create table action (under the Excel Online (Business) connector) and provide the following parameters:

  • Location: Select the SharePoint site address from the dropdown menu.
  • Document Library: Select the document library where the Excel file is stored.
  • File: Provide the dynamic content from the Create file action, using body/Id.
  • Table Range: Specify the range based on the number of columns you have. For example, if you have seven columns, use A1:G1. Adjust this range according to your columns.
  • Table Name: Enter a name for the table.
  • Column Names: List all the column names you want to include in the table.
How to Export SharePoint List to Excel in Power Automate

8. Now, let’s add a row to the table. Click the + icon to add the Add a row into a table action (under the Excel Online (Business) connector) and provide the required parameters:

  • Location: Select the SharePoint site.
  • Document Library: Choose the Documents folder.
  • File: Provide the dynamic content from the Create file action, using body/Id.
  • Table: Select the table name from the dynamic content.
  • Row: Provide the values for each column in the table. Map the dynamic content for each column as needed.
Column NameDynamic Content
Titleitems()?[‘Title’]
Statusitem()?[‘Status’]?[‘Value’]
Initial Email Dateitem()?[‘InitialEmailDate’]
1st Reminder Dateitem()?[‘1stReminderDate’]
Categoryitem()?[‘Category’]?[‘Value’]
Due Dateiitem()?[‘DueDate’]
Email Addresseesitem()?[‘EmailAddressees’]
export sharepoint list to excel using Power Automate

9. Next, add a delay action and provide the count as 1 and Unit as Minute.

power automate SharePoint list export to excel

10. Now add a Get file content action for SharePoint Connector and configure the required parameters:

  • Site Address: Select the SharePoint site address from the dropdown.
  • File Identifier: Provide the dynamic content from the Create file action, using body/Id.
Power Automate Send SharePoint files as attachments

11. Now, add a Send an email action to send the Excel file. To do this, add the Send an email action with the following parameters:

  • To: Enter the recipient’s email address (e.g., the manager’s email).
  • Subject: Provide a subject for the email.
  • Body: Write the body content of the email, including any message or instructions.
  • Attachments: Attach the Excel file by using the dynamic content File Content from the Create file action.
How to Export SharePoint List to Excel and Send an Email using Power Automate

Run the Flow to Export the SharePoint List to Excel and Send an Email

Now, it’s time to save the flow. Click on Test -> Select Manually -> click Test. After the flow runs successfully, go to the SharePoint library, and you will see that the file has been successfully created.

power automate sharepoint list to excel

Also, you can check Outlook emails; the email comes with an Excel attachment.

sharepoint list to excel power automate

In this tutorial, I explained how to export a SharePoint list to Excel and send it via email using Power Automate. We also covered how to create a table dynamically, define columns, and add rows in Excel.

Related Power Automate tutorials:

  • This is no longer an expression:
    outputs(‘A1_Notation_Mapping'[sub(length(outputs(‘Array_of_col’)),1)])

    Was anyone able to get this to work still?

  • Correct to include a valid reference to ‘Array_of_col’ for the input parameter(s) of action ‘Create_table’.

    Correct to include a valid reference to ‘A1_Notation_Mapping’ for the input parameter(s) of action ‘Create_table’.

    I get both of those errors in flow checker.

  • Hello,
    this is not working for me either!
    I keep getting ‘The expression is invalid.’ when inserting outputs(‘A1_Notation_Mapping'[sub(length(outputs(‘Array_of_col’)),1)]).
    @Bijay Kumar any tips please??

  • One question, how can I bring more than 100 items in Get Items, since it only brings 100 and if I have more than 100 records it does not generate them in the excel table. Thanks

  • I keep getting ‘The expression is invalid.’ when inserting outputs(‘A1_Notation_Mapping'[sub(length(outputs(‘Array_of_col’)),1)]).
    @Bijay Kumar any tips please??

  • Unfortunately both versions of the

    outputs(‘A1_Notation_Mapping’)[sub(length(outputs(‘Array_of_col’)),1)] and outputs(‘A1_Notation_Mapping'[sub(length(outputs(‘Array_of_col’)),1)]) are giving me the error, has anyone been able to find a working solution?

    • You have to change the name of the flows as show in the images below for example when you do “Compose” PowerAutomate will just name it Compose, Compose1, Compose2 so on. You have to click the 3 polka dots, click rename and rename it to “A1 Notation Mapping” or “Array of col” respectively. Also correct formula to use is this outputs(‘A1_Notation_Mapping’)[sub(length(outputs(‘Array_of_col’)),1)]
      The single quotes aren’t being recognized because it’s a different font. Fix the quotes or copy paste the one in this comment, up to you.

        • Chris it worked for me but when I pasted the formula I had to correct the quotations, so basically wipe out the quotations around A1 Notation Mapping and retype them ‘. Also, I didnt have underscores.

          This is what I used, but remember, delete the quotations and retype them because when you copy paste it reformats them incorrectly: outputs(‘A1 Notation Mapping’)[sub(length(outputs(‘Array of col’)),1)]

          • this worked for me. I think its best you write the code in, instead of copy and paste.

  • Sorry correction, keep the underscores, I just got a warning and I had to add them and now it works! so it should be A1_Notation_Mapping and Array_of_col

  • Hello,
    I have a problem in this Step “10: Add rows to the excel table”.
    I can’t provide the name from the dynamic content (I don’t have expression field) and i don’t have Row field.

    Can you help me?
    Thanks

  • I am having a issue with this expression when using the create a table.

    outputs(‘A1_Notation_Mapping’)[sub(length(outputs(‘Array_of_col’)),1)]

    It is returning this error.
    The argument is invalid or missing or has an incorrect format.
    clientRequestId: 556c0553-59e4-4184-805c-79ea66f5b408
    serviceRequestId: 6d499c8d-354e-41a1-b7b2-f0d99560e3c9

    Also the value that is being shown in the table range is ($A1:$N)
    So I think that the outputs formula has something wrong in it. Any help would be much appreciated.

        • *TIPS ON HOW TO FIX*
          I’m including feedback from other people, so I do not take full credit.

          1. Make sure you have renamed the step after “Create CSV table” and before “Get file content” to “Array of col”.
          2. Make sure you have renamed the step after “Create file” and before “Create table” to “A1 Notation Mapping”.
          3. In the table range, make sure you type “$A1:$” first.
          4. When you paste the formula, re-enter the ‘ symbols.
          outputs(‘A1_Notation_Mapping’)[sub(length(outputs(‘Array_of_col’)),1)]

  • Flow run failed in the “Add a row ito a table” step , the error message is : “unsupported Media Type , the request entity’s media typ ‘text/plain’is not supported for this resource” and how to fixed ? thanks

    • Had the same issue. When the dynamic choices come up, make sure to select the “Output” option under the “Select” category, meaning that it is taking the output from the “Select” step at the beginning as opposed to the output of the CSV. To be honest, I’m not certain that’s overall correct, but it made the flow run successfully.

  • I’m having a different problem to most, I have changed the problem expression as others have suggested (but also removed the spaces for ease) but when I run the flow I get this error:
    “Unable to process template language expressions in action ‘Create_table’ inputs at line ‘0’ and column ‘0’: ‘The template language expression ‘outputs(‘A1NotationMapping’)[sub(length(outputs(‘Arrayofcol’)),1)]’ cannot be evaluated because property ‘7’ cannot be selected. Property selection is not supported on values of type ‘String’.”
    Anyone any ideas?

  • Hi All, this is a great tool and working for me great after reading the comments in the email. Unfortunately, when I receive the email the file states it could be corrupted. Any ideas or thoughts to fix this?

  • Different problem from most- If I run the aforementioned flow steps without the “Apply to Each” function, the document and table is created. However, I run into a problem in the “Add a row into a table” function. After selecting File= Id, I am presented with the following error in the Table section:

    Could not retrieve values. Value segment type ‘literal’ expression ” invalid. Only literal segment types may be used.
    Copy Error

    Does anyone know what the issue may be? As mentioned, all previous steps work until trying to create this function.

  • I’m stuck on the 2nd step. I changed the Query filter to match my column header(Active Employye) and data(Yes) but I keep receiving an error:
    The expression “Active Employee eq ‘Yes'” is not valid. Creating query failed.
    clientRequestId: 30c6a3ab-63ef-4e40-a67e-e430bd9730bc
    serviceRequestId: 30c6a3ab-63ef-4e40-a67e-e430bd9730bc
    Any Suggestions?

  • Hi,

    i have 2 issues

    first beeing Status EQ ‘DELIVERED’ creating an error saying status does not exist. removing the filter seems to have it working tru.

    second, beeing that darn “apply to each” issue, for some reason its stops saying “A value must be provided for item.
    clientRequestId: 85cb1274-1e0d-4496-ab50-4269d9a6381b”

    {
    “message”: “A value must be provided for item.rnclientRequestId: 85cb1274-1e0d-4496-ab50-4269d9a6381b”,
    “status”: 400,
    “error”: {
    “message”: “A value must be provided for item.”
    },
    “source”: “excelonline-eus.azconn-eus-002.p.azurewebsites.net”
    }

    i have triple checked my output to be the correct one as well as id, name, current item.

    even tried tweeking Select nothing come along the issue havent manage to get 1 complete run yet so far.

    thanks for all the help.

  • Hi All, the ‘Add row into table’ has reported a Unsupported Media Type under Apply to Each.

    Error: Action ‘Add_a_row_into_a_table’ failed
    Error Details: The request entity’s media type ‘text/plain’ is not supported for this resource.

    Any ideas.
    Thanks

  • Error Details
    Start time
    Oct 12, 06:59 PM (9 seconds ago9 sec ago)
    Duration
    00:00:05
    Error
    Action ‘Create_table’ failed
    Error Details
    The argument is invalid or missing or has an incorrect format.
    clientRequestId: 2d6010ca-7e82-499c-8902-855c17718a63
    serviceRequestId: 1bbdd434-fa8a-4c2b-bd66-c09336137eb0;041f962a-6af8-4532-9383-448948b7272a

    I have an issue in create a table please guide me
    $A1:$ outputs(‘A1_Notation_Mapping’)[sub(length(outputs(‘Array_of_col’)),1)]
    first(split(body(‘Create_CSV_table’),decodeUriComponent(‘%0D%0A’)))
    but not working

  • Hi Bijay,
    good sharing…thanks a lot.
    yet while i follow the steps, come out with error:
    Error
    Action ‘Create_table’ failed
    Error Details
    The resource could not be found.
    clientRequestId: aa025608-6180-491d-8963-fef8473a048b
    serviceRequestId: 09892b2c-d63b-4332-96b6-299179bd3bfe

    do you have any idea on this? thanks

  • I think solution which is present here ….. it is one big s.h.i.t

    outputs(‘A1_Notation_Mapping’)[sub(length(outputs(‘Array_of_col’)),1)]

  • anyone getting this error:

    The request is forbidden by Graph API. Error code is ‘AccessDenied’. Error message is ‘Could not obtain a WAC access token.’.
    clientRequestId: 7d8d0012-0318-4461-84e4-4145f142111f
    serviceRequestId: cfb00024-2d7d-4323-8796-82385e3814d9

  • Hi,
    Can we also do this for a document library? I am trying to mimic the export to excel function using power automate for a document library. I am not sure which connector to use as Get items only works for Lists. Any suggestions would be appreciated. thanks

  • Create CSV table error:
    BadRequest. The ‘from’ property value in the ‘table’ action inputs is of type ‘String’. The value must be of type ‘Array

  • >

    Build a High-Performance Project Management Site in SharePoint Online

    User registration Power Apps canvas app

    DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

    Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

    Power Platform Tutorial FREE PDF Download

    FREE Power Platform Tutorial PDF

    Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…