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 / Perform lookup Functio...
Power Automate
Answered

Perform lookup Function in excel through power automate.

(0) ShareShare
ReportReport
Posted on by 30

How can I Perform lookup Function in excel through power automate?

Please guide me with some Steps and I will be thankful to you.

Categories:
I have the same question (0)
  • GeoffRen Profile Picture
    Microsoft Employee on at

    Can you explain with an example what you mean by 'lookup Function'?

  • Zulqarnain97 Profile Picture
    30 on at

    Actucally i want to utilize the vlookup function on power Automate 
    fort function reference please click the link :https://download.microsoft.com/download/9/b/4/9b49c8c5-d7a9-45b1-b8b6-52067e9970a8/AF101984660_en-us_xl_qrc_vlookup%20refresher.pdf 

  • Verified answer
    GeoffRen Profile Picture
    Microsoft Employee on at

    I would recommend using Office Scripts, specifically Office Scripts with Power Automate. This is the 'Run Script' action on the Excel connector. With Office Scripts you can use the 'Run Script' action to execute javascript against a workbook. Here's a quick sample script that takes the sheet, range you want the formula to be set in, and the formula as parameters. It then sets the formula and reads and returns that value back to Power Automate. So you can pass in any formula you like, not just vlookup.

    function main(workbook: ExcelScript.Workbook, sheetName: string, formulaRangeAddress: string, formula: string) {
     let sheet = workbook.getWorksheet(sheetName);
     let formulaRange = sheet.getRange(formulaRangeAddress);
     formulaRange.setFormula(formula);
     return formulaRange.getValue();
    }

     

  • paritoshvyas Profile Picture
    2 on at

    Hi, 

    Can you share an example on how the above script would be used

  • 123213123 Profile Picture
    on at

    @GeoffRen hello, can you share example how to use it? 

  • GeoffRen Profile Picture
    Microsoft Employee on at

    Can you share what you have tried so far? Have you looked at the linked documentation and tried to run the script from Excel to test it? I made some small changes that will let you test it from within Excel with a very small example below:

     

    function main(workbook: ExcelScript.Workbook, sheetName: string, formulaRangeAddress: string, formula: string) {
    	sheetName = "Sheet1";
    	formulaRangeAddress = "A1";
    	formula = "=A2+A3";
    
    	let sheet = workbook.getWorksheet(sheetName);
    	let formulaRange = sheet.getRange(formulaRangeAddress);
    	formulaRange.setFormula(formula);
    
    	console.log(formulaRange.getValue());
    
    	return formulaRange.getValue();
    }

     

    GeoffRen_0-1659977879100.png

     

  • 123213123 Profile Picture
    on at

    VLOOKUP is working now, but it doesn't when i try to add IFERROR expression:

    formula = "=IFERROR(VLOOKUP(D2,SHEET1!A:G,2,FALSE),"no")";

    Should i leave below 3 options blank?

    123213123_0-1659980481824.png

     

  • GeoffRen Profile Picture
    Microsoft Employee on at

    Can you share what you mean by it isn't working? Does the script work when you run from directly in Excel? Can you also try escaping the quotations, ie "=IFERROR(VLOOKUP(D2,SHEET1!A:G,2,FALSE),\"no\")"

  • 123213123 Profile Picture
    on at

    it works now when i run directly in Excel by adding the \ \ as per your instructions.
    thank you!

  • 123213123 Profile Picture
    on at

    is it possible to combine two vlookup formulas in one script? the return index number will only change.

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 607

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard