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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extract Tables from PD...
Power Automate
Suggested Answer

Extract Tables from PDF - not fixed columns

(0) ShareShare
ReportReport
Posted on by 2
I have a PAD flow created to extract values from Tables in a PDF file using the action Extract Tables from PDF. Though it is a PDF table and fixed position, the extraction table columns and roles are not fixed when returning. As a result, it is always a challenge to read the desired value from the data table for further data manipulation. Is there a better way to resolve this? 
 
 
 
 
 
 
 
 
These are the two tables i extract from the PDF file. The columns and rows in the extraction result table at times varies. 
 
Thanks in advance 
P20
I have the same question (0)
  • Suggested answer
    VishnuReddy1997 Profile Picture
    2,656 Super User 2025 Season 2 on at
     
    If the column names are same try to Retrieve the Required column Data into list as shown in below.
     
     
    If the column names are also different then you need you either AiBuilder or Azure Document Intelligence.
     
    Regards,
    Vishnu Reddy
  • Suggested answer
    Riyaz_riz11 Profile Picture
    3,893 Super User 2025 Season 2 on at
    Hi,
     

    Solution 1: Text-Based Extraction with RegEx (Recommended)

    Instead of table extraction, use text extraction with pattern matching:

      
    // Extract text from PDF
    PDFActions.ExtractTextFromPDF File: PDFFile ExtractedText=> ExtractedText
    
    // Use RegEx to find specific patterns
    Text.ParseTextWithRegularExpression.ParseForFirstMatch Text: %ExtractedText% RegularExpressionPattern: '(\d{1,2},\d{3}\s+P)\s+(\d{1,3},\d{3})' IgnoreCase: True Match=> CoasterMatch
    
    // Extract specific values using known patterns
    Text.ParseTextWithRegularExpression.ParseForFirstMatch Text: %ExtractedText% RegularExpressionPattern: '11,000\s+P\s+(\d{1,3},\d{3})\s+(\d{1,3},\d{3})' IgnoreCase: True Match=> ElevenThousandMatch
    
    // Access extracted values
    SET EastValue TO %ElevenThousandMatch.Groups[1].Value%
    SET WestValue TO %ElevenThousandMatch.Groups[2].Value%
     

    Solution 2: Smart Table Processing with Headers

    Process the extracted table by finding headers first:

    // After extracting table
    PDFActions.ExtractTablesFromPDF File: PDFFile ExtractedTables=> ExtractedTables
    
    // Find header row containing "East" and "West"
    LOOP FOREACH CurrentRow IN %ExtractedTables[0]%
        IF %CurrentRow% CONTAINS 'East' AND %CurrentRow% CONTAINS 'West' THEN
            SET HeaderRowIndex TO %LoopIndex%
            // Find column positions
            LOOP FOREACH CurrentCell IN %CurrentRow%
                IF %CurrentCell% = 'East' THEN
                    SET EastColumnIndex TO %LoopIndex%
                END IF
                IF %CurrentCell% = 'West' THEN
                    SET WestColumnIndex TO %LoopIndex%
                END IF
            END LOOP
            EXIT LOOP
        END IF
    END LOOP
    
    // Now extract data using found positions
    SET EastValue TO %ExtractedTables[0][HeaderRowIndex + 1][EastColumnIndex]%
    SET WestValue TO %ExtractedTables[0][HeaderRowIndex + 1][WestColumnIndex]%
     
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 507 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 267 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard