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

How to get the last row of an Excel file

Hi,

 

I would like to create a flow that get the last row of and excel file and send it by email, but I don't know how to set up the excel action. Someone can help me?

 

The excel file is hosted on Sharepoint.

 

Thanks.

Regards.

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi @vgarcia ,

 

Do you want to get last row of an Excel file?

 

Please try with the function last in WDL:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#l...

 

I have made the following flow for your reference.

 

Trigger the flow by a Button, then the Excel Online action List rows present in a table.

 

Note: at here you could set the Location as SharePoint site, I am using OneDrive in my scenario.

 

Then add a Compose action with the following code:

last(body('List_rows_present_in_a_table')?['value'])

 

Add the action send an email, input code likes below to get value of each column:

 

outputs('Compose')?['email']

outputs('Compose')?['name']

 

 

Images for your reference:

1.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yamao-msft
Community Support
Community Support

Hi @vgarcia ,

 

Do you want to get last row of an Excel file?

 

Please try with the function last in WDL:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#l...

 

I have made the following flow for your reference.

 

Trigger the flow by a Button, then the Excel Online action List rows present in a table.

 

Note: at here you could set the Location as SharePoint site, I am using OneDrive in my scenario.

 

Then add a Compose action with the following code:

last(body('List_rows_present_in_a_table')?['value'])

 

Add the action send an email, input code likes below to get value of each column:

 

outputs('Compose')?['email']

outputs('Compose')?['name']

 

 

Images for your reference:

1.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

 @v-yamao-msft @vgarcia  -

 

Hi Mabel/gracia

I tried the same way as you have discussed below. 

My flow is failing at Sens mail action with error , Please find screenshot below.

 

Could you suggest resolution for it. does is require string formatting?

 

 

FlowError.PNG

 

Hi, Im having trouble getting the output expression to work.

 

Getting this error:

InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_notification_(V3)' inputs at line '1' and column '2774': 'The template language expression 'outputs('Compose')?['Next'] ' cannot be evaluated because property 'Next' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.
 
I've ran the flow through a test and the list + compose bits are passing but its failing at email. 
 
I've followed your example - the only difference is changing ['name'] for ['Next']. This is one of the columns from my excel sheet that is being successfully called in the list. 
 
Any help would be massively appreciated!

Hi @v-yamao-msft, Thank you for sharing this solution. I've actually tried it on an approval flow which i've created for leave request. I have a query: I've uploaded a leave request excel sheet on onedrive & if my team member updates the last row with his/her leave request and trigger the manual flow with approver's email address. The approver recieves the Approve/Deny tab over email and he submits the same. How can we record the approvers response in this case back to the excel sheet (last row) available on one drive. Can you please help. Thanks.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,523)