How to Write a Node.js Code to Search Through an Array and Find a Pre-Defined Value in a Google Sheet Trigger Event?

It seems like there might be a misunderstanding in how you’re accessing the fields within the changes array. The changes array contains objects with keys like cell, new_value, and previous_value, but your code is attempting to access fields dynamically using arrayToSearchThru. To fix this, you should directly check the new_value field for the presence of wordToSearchFor. Here’s an updated version of your code: export default defineComponent({ props: { wordToSearchFor: { type: "string", label: "Word to Search For", }, arrayToSearchThru: { type: "string[]", label: "Array to Search Through", }, }, async run({ steps, $ }) { const changes = steps.trigger.event.changes; // The array of changes const wordToSearchFor = this.wordToSearchFor; // Word to search for // Filter changes to find matches in the new_value field const results = changes .filter(change => { // Check if the word exists in the new_value return change.new_value && change.new_value.includes(wordToSearchFor); }) .map(change => { // Map the results to return desired values const { cell, new_value, previous_value } = change; return { cell, new_value, previous_value }; }); return results; // Return the filtered and mapped results }, }); In this version, the code filters the changes array by checking if wordToSearchFor is included in the new_value of each change. This should return the expected results if wordToSearchFor is present in any new_value. If you need to search through other fields, you can adjust the logic accordingly.