cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Support
Community Support

Re: How to get the last row of an Excel file

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
Highlighted
Community Support
Community Support

Re: How to get the last row of an Excel file

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

Highlighted
Frequent Visitor

Re: How to get the last row of an Excel file

 @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

 

Highlighted
New Member

Re: How to get the last row of an Excel file

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!
Highlighted
Helper I
Helper I

Re: How to get the last row of an Excel file

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Users online (7,061)