
Announcements
Hello All,
How we can write an office script to get each row in excel .
Hey @AK88
You need to learn the fundamentals Office Script -https://learn.microsoft.com/en-us/office/dev/scripts/develop/scripting-fundamentals
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.