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

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,402 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

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

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard