cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
123213123
Helper I
Helper I

vlookup function office script

hi everyone,

 

I am trying to create an office script that i can use in my power automate flow however i don't know how to apply the VLOOKUP formula via office script.

 

Can anyone please help me with filling in below office code with this VLOOKUP Formula?
=IFERROR(VLOOKUP(D2,Sheet2!A:G,1,FALSE),"no")

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();
}

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @123213123 

 

You could this using without the script. 

 

Read the first worksheet

Read the second worksheet and use the filter query to match the record

Update the first worksheet using second worksheet values.

 

If you have too many records to update maybe script is the best option. 

 

Have a look at this blog and it may be useful.

 

How to compare two columns in Excel using VLOOKUP (ablebits.com)

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

1 REPLY 1
abm
Super User
Super User

Hi @123213123 

 

You could this using without the script. 

 

Read the first worksheet

Read the second worksheet and use the filter query to match the record

Update the first worksheet using second worksheet values.

 

If you have too many records to update maybe script is the best option. 

 

Have a look at this blog and it may be useful.

 

How to compare two columns in Excel using VLOOKUP (ablebits.com)

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (4,323)