Help with Map and indexOf function

110 views
Skip to first unread message

Pramod Mani

unread,
Feb 26, 2022, 3:51:03 PM2/26/22
to Google Apps Script Community
Hi, 

I am totally new to Google Scripts. 

Referring to attached image, please help me with a script that look for Keywords (Column D) in B and C columns (Range B2: C8) and populate Notes column E with custom texts like highlighted in Orange.

Since the data set can be huge, I do not want to use For loop. I tried using Map function and indexOf but didn't succeed.

Your help is truly appreciated. Thanks in advance!

google-scripts.jpg

Message has been deleted

Zack Reynolds

unread,
Feb 28, 2022, 3:01:11 PM2/28/22
to Google Apps Script Community
So as long as you're not pulling a row of data at a time and are working with the entire dataset you're parsing, using the .map or .filter method does not really save any processing time compared to a for loop, so if a for loop makes sense to you, use it.

Stuart Smith

unread,
Mar 1, 2022, 11:08:48 AM3/1/22
to Google Apps Script Community
Can you provide more detail on what you are trying to accomplish?

How would the script know that if it finds a match for "Cox" it should write "Car Insurance"?  Or that if it finds "Yogi" it should write "Yogiji"?  Is there another table?
Reply all
Reply to author
Forward
0 new messages