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

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
    CU16071609-1 Profile Picture
    6,255 Moderator 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,666 Super User 2026 Season 1 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

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard