Announcements
How can I Perform lookup Function in excel through power automate?
Please guide me with some Steps and I will be thankful to you.
Can you explain with an example what you mean by 'lookup Function'?
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
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(); }
Hi,
Can you share an example on how the above script would be used
@GeoffRen hello, can you share example how to use it?
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(); }
VLOOKUP is working now, but it doesn't when i try to add IFERROR expression:
Should i leave below 3 options blank?
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\")"
it works now when i run directly in Excel by adding the \ \ as per your instructions.thank you!
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Haque 607
Valantis 340
11manish 284