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 / Fuzzy Lookup In Excel ...
Power Automate
Unanswered

Fuzzy Lookup In Excel Using Office Script

(1) ShareShare
ReportReport
Posted on by 4

 Hi All,

 

I have a flow where a user enters a message, that message is checked in an excel sheet and it returns the value alongside it (basically a vlookup) using the "Run a script" excel connector.

e.g.: If a user types "Microsoft Power Platform Issue", it goes and checks in the sheet (say if its in cell A1) and returns the value from the cell B1.

 

But currently, its doing exact word mapping. If I add a letter more than that, it fails to recognize. Is there a way I could make it recognise keywords ?

 

Please help. 

 

My script is one of those suggested in the community only:

 

function main(workbook: ExcelScript.Workbook, studentId: string) {

 studentId = 'S1'; /* for testing purpose */
 let table2 = workbook.getTable("Table2");
 // Clear filter on column '0'
 table2.getColumns()[0].getFilter()
 .clear();
 // Apply custom filter on table Table2 column Student ID
 table2.getColumnByName("Student ID")
 .getFilter()
 .applyCustomFilter(`=${studentId}`);

 let range = table2.getColumnByName('Exam ID').getRangeBetweenHeaderAndTotal().getVisibleView();
 let rowCount = range.getRowCount()
 console.log("Filtered row count: " + rowCount);
 if (rowCount === 0) {
 console.log("No match on the student Id");
 return {
 result: "No data",
 message: "Sorry, we could not retrieve the exam ID based on the student ID you provided. Please check and try again."
 }
 }
 if (rowCount === 0) {
 console.log("No match on the student Id");
 return {
 result: "No data",
 message: "Sorry, we could not retrieve the exam ID based on the student ID you provided. Please check and try again."
 }
 } else if (rowCount !== 1) {
 console.log("Invalid result");
 return {
 result: "Internal error",
 message: "Sorry, there was an internal error processing your request. Please try later."
 }
 } 
 let examId = range.getValues()[0][0]
 console.log(examId)
 return {
 result: "Success",
 message: `Your examd Id is ${examId}.`
 }
}

interface Response {
 result: string,
 message: string
}

 

 

Categories:
I have the same question (0)
  • mgrachii Profile Picture
    206 on at

    Hi there,
    Have you tried this:

     

    .getFilter().applyCustomFilter("=*{your text}*");
     
    Adding the " * " will indicate the "contains" logic

    Hope this helps.



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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 484

#2
11manish Profile Picture

11manish 282

#3
David_MA Profile Picture

David_MA 280 Super User 2026 Season 1

Last 30 days Overall leaderboard