cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AdriP
Level: Powered On

Extracting PDF data with Form Recognizer and saving it to Sharepoint

Hi all,

 

I am currently trying to extract data from a PDF file with Microsoft Form Recognizer whenever

a file is uploaded on my Sharepoint site. The extracted data shall be added to the original file as Metadata.

Everything worked quite fine besides the usage of the template language expression to use the JSON output from Form

Recognizer to find the adequate key - value pairs and add their data to the PDF.

 

The JSON output from Form Recognizer looks like this:

grafik.png

 

My Flow looks like this:

grafik.png

 

In update file properties I try to get the data from JSON via the expression:

It seems to be working because I do not get an error anymore but the metadata field is empty.

 

body('Parse_JSON')?['pages'][0]?['Datum:']?['value']
 
if I try any other Index than [0] I get this error and I do not understand why:
grafik.png
 
To be honest I do not really understand the template language expression and how to iterate through an array.
Additionally it does not make too much sense for my purpose because I wanted to be able to
analyze documents with another format as well. Whenever the key - value pair I want to extract is in another line it would not 
work if I work with Indexes.
 
I would appreciate any help.
 
Best regards,
AdriP
 
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Extracting PDF data with Form Recognizer and saving it to Sharepoint

Hi @AdriP 

 

You need to include the "body('Parse_JSON')?['pages'][0]?['Datum:']?['value']" into a "Apply For Each" and then perform your actions. 

 

Something like this:

Screenshot 2020-01-02 at 09.43.54.png

 

The error message is indicating that you're trying to use an array that is empty, so it's trying to access position 1 but that position is not available.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

1 REPLY 1
Super User
Super User

Re: Extracting PDF data with Form Recognizer and saving it to Sharepoint

Hi @AdriP 

 

You need to include the "body('Parse_JSON')?['pages'][0]?['Datum:']?['value']" into a "Apply For Each" and then perform your actions. 

 

Something like this:

Screenshot 2020-01-02 at 09.43.54.png

 

The error message is indicating that you're trying to use an array that is empty, so it's trying to access position 1 but that position is not available.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,907)