
Announcements
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
}
Hi there,
Have you tried this: