web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard