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 / Write into Excel sheet
Power Automate
Unanswered

Write into Excel sheet

(1) ShareShare
ReportReport
Posted on by 34

Hello,

I am trying to extract table data from a PDF file. The "ExtractedPDFTables" variable contains many tables, but I want to write data only from index 4 onwards into an Excel sheet because the data up to index 3 is not structured. Please advise me on how to resolve this.

AT88_0-1720469999860.png

 

.

 

I have the same question (0)
  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @AT88 

     

    Try below approach:

    Deenuji_0-1720495926379.png

     

     

    Code:

    Pdf.ExtractTablesFromPDF.ExtractTables PDFFile: $'''C:\\Boot\\platform.pdf''' MultiPageTables: True SetFirstRowAsHeader: True ExtractedPDFTables=> ExtractedPDFTables
    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    LOOP LoopIndex FROM 0 TO ExtractedPDFTables.Count STEP 1
     IF LoopIndex >= 4 THEN
     Excel.GetFirstFreeColumnRow Instance: ExcelInstance FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: ExtractedPDFTables[LoopIndex].Datatable Column: $'''A''' Row: FirstFreeRow
     END
    END

     

    How to copy/paste the above code into your PAD?

    Deenuji_1-1720496015365.gif

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Verified answer
    VishnuReddy1997 Profile Picture
    2,656 Super User 2025 Season 2 on at

    Hi @AT88 ,

     

    Please find the solution.

    VishnuReddy1997_0-1720495727224.png

     

    Code:

    Please Copy the below code to your flow.

    Pdf.ExtractTablesFromPDF.ExtractTables PDFFile: $'''C:\\Users\\Desktop\\Power Automate Desktop\\Practice\\PDF\\Input\\pdf tables.pdf''' MultiPageTables: True SetFirstRowAsHeader: True ExtractedPDFTables=> ExtractedPDFTables
    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    SET LoopNumber TO 0
    LOOP FOREACH CurrentItem IN ExtractedPDFTables
     IF LoopNumber >= 4 THEN
     Excel.GetFirstFreeColumnRow Instance: ExcelInstance FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: CurrentItem Column: $'''A''' Row: FirstFreeRow
     END
     Variables.IncreaseVariable Value: LoopNumber IncrementValue: 1
    END
    Excel.CloseExcel.CloseAndSave Instance: ExcelInstance

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard