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 / How to create a office...
Power Automate
Answered

How to create a office script to get the each row in excel

(0) ShareShare
ReportReport
Posted on by 453

Hello All, 

 

 

How we can write an office script to get each row in excel . 

Categories:
I have the same question (0)
  • Verified answer
    CFernandes Profile Picture
    8,504 Most Valuable Professional on at

    Hey @AK88 

     

    You need to learn the fundamentals Office Script -https://learn.microsoft.com/en-us/office/dev/scripts/develop/scripting-fundamentals

     

    CFernandes_0-1682495690537.png

     

    Script -

     

    function main(workbook: ExcelScript.Workbook) {
     // Get the active worksheet
     let sheet = workbook.getActiveWorksheet();
    
     // Get the used range of the sheet
     let usedRange = sheet.getUsedRange();
    
     // Get the row count of the used range
     let rowCount = usedRange.getRowCount();
    
     // Loop through each row of the used range
     for (let i = 0; i < rowCount; i++) {
     // Get the row using the index
     let row = usedRange.getRow(i);
    
     // Do something with the row
     console.log(row.getValues());
     }
    }
    

     

    You can also look at my video - https://www.youtube.com/watch?v=4Xzobptejp4 

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 573

#2
Valantis Profile Picture

Valantis 407

#3
11manish Profile Picture

11manish 387

Last 30 days Overall leaderboard