web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting PDF Table a...
Power Automate
Unanswered

Extracting PDF Table and Writing Specific Columns to Excel

(0) ShareShare
ReportReport
Posted on by

I have been playing with the Extract PDF Tables function to extract employee details from the 97 pages of rosters on my employer's monthly insurance invoice. So far, the function has worked great. I've been able to extract specific tables from specific pdf pages, run everything through a loop, and write it all to an Excel Spreadsheet.

 

My issue is that some of the tables with roster information have an extra column for "Suffix", so if an employee is "John Smith III", the Suffix column is present on that table. Since there are only a few employees with a suffix in their name, there are several tables without the Suffix column.

 

An Example of what the two different style tables would look like:

 

Table 1

First NameLast NameSuffixProductPrice
JohnSmithIIIHealth$100
Luke Skywalker Health

$100

Ahsoka Tano Dental$20

 

Table 2

FirstNameLast NameProductPrice
BibFortunaHealth$100
DinDjarinDental$20

 

This results in me getting something like this in my Excel File:

First NameLast NameSuffixProductPrice
JohnSmithIIIHealth$100
Luke SkywalkerHealth

$100

 
Ahsoka TanoDental$20 
BibFortunaHealth$100 
DinDjarinDental$20 

 

 

I've been playing with a sample PDF online and have been able to extract.

 

I've been able to write the table as a whole using by writing %ExtractedPDFTables[2].Datatable%

 

I've been able to write specific rows, like the first 3 rows, by using %ExtractedPDFTables[2].Datatable[0:3]%

 

Is there a way to exclude a column when writing these data tables to Excel?

 

 

 

 

 

 

 

I have the same question (0)
  • Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Hi @BigGoob ,

     

    Use %ExtractedPDFTables[0].DataTable.ColumnHeadersRow% to extract the DataTable Headers. Now, based on conditions extract the data.

     

    Hope this will help you.

     

    Regards

    Kaif

  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    You could do some conditional work during the extraction.

    If a table does not contain the 'Suffix' header (or if header count = 4) write the table into Excel, add an empty column, then read the data from Excel again.

  • ConwayHR Profile Picture
    17 on at

    BigGoob here, I am on my work profile.

     

    I had forgotten that my actual table has one row above the column headers that says "view roster". Is this still achievable? 

     

    View Roster   
    FirstNameLast NameProductPrice
    BibFortunaHealth$100
    DinDjarinDental$20
  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    It sure is. You can cut off the first two rows: %DataTable[2:DataTable.RowsCount]%

  • Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Yes, it works. I tested with below data and extract only headers.

    Kaif_Siddique_0-1664822159794.png

     

    Also, @Henrik_M shared some good suggestions. You can try it as well.

     

    Regards

    Kaif

  • ConwayHR Profile Picture
    17 on at

    Thank you for the feedback. I am still having a little bit of trouble.

     

    I don't want to include the "View Roster" row, I want "First Name", "Last Name", "Product", and "Price" to be the header. Can I do that?

     

    Would I just need to make sure the "First line contains column names" is on in the settings and then write %ExtractedPDFTables[0].DataTable[1][First Name, Last Name, Product, Price]?

  • takolota1 Profile Picture
    4,980 Moderator on at

    With AI Builder, you could also try this template to extract any PDF data to a JSON object:

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Extract-Data-From-PDFs-and-Images-With-GPT/td-p/2201345

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 253 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 172 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 134 Super User 2026 Season 2

Last 30 days Overall leaderboard