cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnOO82
Helper I
Helper I

Extract result from excel to Power Automate Flow

Hello everyone

 

I have problems with my flow.

 

It actual gets all the individual codes from each file (located in two different folders) and write it into a table. An short script brings the numbers in the correct order. I needed an array with all the Codes. I used an Excel function to create it.

 

Now the problem: I can't find any action to extract the information back to Power Automate.

 

I need: [4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]

 

so that my follwing steps can find all the missing numbers.

 

Does anyone has an idea? 

1 ACCEPTED SOLUTION

Accepted Solutions

Assuming we are getting the Barcodes from a column in the folder, this is how I would build the flow.

 

For this example, I have a library called PDFs with three folders, Folder A, Folder B, and Folder C. We will get the files from Folder A and Folder B only.

grantjenkins_0-1672300883015.png

 

grantjenkins_1-1672300900367.png

 

grantjenkins_2-1672300918101.png

 

See full flow below. I'll go into each of the actions.

grantjenkins_3-1672301083483.png

 

Get files x 2 retrieve the files from the two folders.

grantjenkins_5-1672301160083.png

 

Select uses a union expression to combine the values of both Get items. For the Map, it uses Text mode (see arrow on screenshot below) and converts each Barcode to a number. See expressions below. This will output an array of unsorted numbers.

//From (input)
union(outputs('Get_files_(properties_only)_Folder_A')?['body/value'], outputs('Get_files_(properties_only)_Folder_B')?['body/value'])

//Map - Barcode (assuming the internal column name is called Barcode)
int(item()?['Barcode'])

grantjenkins_8-1672301622809.png

 

Compose then uses a sort expression to sort the numbers in ascending order. The expression used is.

sort(body('Select'))

grantjenkins_7-1672301533897.png

 

After running the flow, we would have the following output.

[
  1,
  2,
  3,
  5,
  8,
  9,
  10,
  11,
  12,
  18,
  19
]


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

View solution in original post

15 REPLIES 15
fargv88
Regular Visitor

Hi @AnOO82 ,

 

To extract the information from an Excel table and use it in Power Automate, you can use the "Excel - Get rows" action to retrieve the rows from the table and then use the "Compose" action to extract the values that you need from the rows.

Here's an example of how you can do this:

  1. Add the "Excel - Get rows" action to your flow and configure it to retrieve the rows from the table that contains the codes.

  2. Add a "Compose" action to your flow and use the following formula to extract the codes from the rows:

json(body('Excel_-_Get_rows')).value.Code

This formula will extract the values from the "Code" column of the rows and return them as an array of values.

  1. Use the output of the "Compose" action in the following steps of your flow as needed.

With this configuration, the "Compose" action will extract the codes from the Excel table and return them as an array that you can use in the following steps of your flow.

 

I hope this helps. Let me know if you have any questions or if you need further assistance.

AnOO82
Helper I
Helper I

Hi fargv88,

 

thanks for your assistance.

 

The problem with "Get a row" is that I do not have a Key Value or any dynamic content to use.

And I really need the sort-action because the codes are not in the right order and there are also emtpy cells in the list.

Do you have another idea? 🙂

 

 

grantjenkins
Super User
Super User

@AnOO82 A few questions:

  1. How many files are you trying to extract data from?
  2. Are they Excel files or CSV files?
  3. If Excel files, do they have Tables defined, or just raw data?
  4. Do they all have the same headers (Column titles)?
  5. Are you able to show the content from the files you are trying to extract from?
  6. What do you want to do with the final output (sorted array of numbers)?

----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
AnOO82
Helper I
Helper I

Hey @grantjenkins 

 

  1. I have two different Sharepoint folders with > 200 .pdf files. Each file has a code, the codes comes from the KI Builder.
  2. My actual flow writes all codes in one Excel file.
  3. and I have only one table in column A
  4. The header is only "Column1"
  5. I have an column for the Codes in my Sharepoint library. 
  6. and I need a [ with all the numbers from the first to the highest number ] .The following steps searches for any missing numbers in the array. That part of my flow already works but for putting both parts together I need the codes in the right order.
fargv88
Regular Visitor

If you don't have a key value or any dynamic content to use with the "Get rows" action, you can retrieve all the rows of the Excel table and then use the "Sort array" action to sort the rows in the correct order.

To use the "Sort array" action, you can do the following:

  1. Add a "Get rows" action to your flow, and specify the table and worksheet that contain the rows that you want to retrieve.
  2. Add a "Sort array" action to your flow, and specify the array that you want to sort. You can use the following expression to reference the array returned by the "Get rows" action:
@variables('ExcelRows')

          3.  In the "Sort array" action, specify the criteria that you want to use to sort the array. You can use the "Field" field to specify the column that contains the codes, and the "Direction" field to specify whether you want to sort the array in ascending or descending order.

         4. Once the array is sorted, you can use the "Select" action to extract the values that you need. For example, you can use an expression similar to the following to extract the values of the "Code" column:

 

@{variables('SortedArray')[0]['Code']}

This will extract the value of the "Code" column from the first row of the sorted array. You can use a similar expression to extract the values from the other rows of the array as well.

I hope this helps! Let me know if you have any other questions.

@AnOO82 Just to confirm - each of your PDF files has a property called Barcode where you get the code from? So, you're not actually retrieving anything from within each PDF file - just getting the value from the property.

 

And is there a reason you are writing the data to Excel? We can easily just build up an array with all the Barcodes and sort them how you want without using Excel if that's what you need.


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

@grantjenkins 

it's like a Code-Sticker for incoming letters, which sticks is on every letter. Just to be save, that there is no letter missing I read out every Code and want to find missing codes. 

I do not really need an Excel file- It was my first idea, because I have to folders where letters are saved and I find it really hart to build an array above two Sharepoint folders.

Assuming we are getting the Barcodes from a column in the folder, this is how I would build the flow.

 

For this example, I have a library called PDFs with three folders, Folder A, Folder B, and Folder C. We will get the files from Folder A and Folder B only.

grantjenkins_0-1672300883015.png

 

grantjenkins_1-1672300900367.png

 

grantjenkins_2-1672300918101.png

 

See full flow below. I'll go into each of the actions.

grantjenkins_3-1672301083483.png

 

Get files x 2 retrieve the files from the two folders.

grantjenkins_5-1672301160083.png

 

Select uses a union expression to combine the values of both Get items. For the Map, it uses Text mode (see arrow on screenshot below) and converts each Barcode to a number. See expressions below. This will output an array of unsorted numbers.

//From (input)
union(outputs('Get_files_(properties_only)_Folder_A')?['body/value'], outputs('Get_files_(properties_only)_Folder_B')?['body/value'])

//Map - Barcode (assuming the internal column name is called Barcode)
int(item()?['Barcode'])

grantjenkins_8-1672301622809.png

 

Compose then uses a sort expression to sort the numbers in ascending order. The expression used is.

sort(body('Select'))

grantjenkins_7-1672301533897.png

 

After running the flow, we would have the following output.

[
  1,
  2,
  3,
  5,
  8,
  9,
  10,
  11,
  12,
  18,
  19
]


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

Thanks for this way short flow without using Excel. That's brilliant.

 

Only one problem: 

The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '@int(item()?['Barcode'])' failed: 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

Why do I get this error?

Is Barcode the internal name of your column in SharePoint? And do any of your rows not contain a barcode?


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

Yes, there are rows where the barcode column is empty - letters before etablish the new routine...

 

The internal name is 

"#Collection(String)","Barcode":"7","Created": 

 

grantjenkins
Super User
Super User

What do you want to do with the rows that don't have a barcode? Do you just want to ignore them?


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

Yes, just ignore. I only need the rows with barcodes

grantjenkins
Super User
Super User

For each of the Get items add a Filter Query to exclude items where the Barcode is null.

 

Barcode ne null

 

grantjenkins_1-1672305781551.png


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

Ohhh yes, it finally worked!! 

Thank you so much for your help and showing me some new functions 🙂

Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Users online (5,282)