0

I am trying to do an automatic keyword search in Google Sheets.

In this sheet, column C contains descriptions of different cities. Cell E1 contains a list of keywords (sometimes a single word, sometimes multiple words or compound words). What I want to be able to do is search for the keywords in the city descriptions, and if they are present, mark an "X" next to the text in column D.

This is as far as I've gotten setting up the script.

function performMatch() {
    let datTab = SpreadsheetApp.get(Active().getSheetByName("Sheet1")
    letKeyWords = dataTab.getRange(1, 5).getValue().split(",")
    let dataRange = dataTab.getRange(2, 3, 20, 1)
  • 1
    It is possible and relatively easy. Highlighting the keywords will probably require you to use richTextValues(). Your should consider focusing your question down to one and only one issue and creating a piece of code for each issue that highlights your unique question. – Cooper Mar 07 '23 at 22:26
  • Ok understood. I think the main issue is how to return yes/no if words listed in one cell are present anywhere in the text contained in another cell. Ideally not sensitive to case. – IntrepidMan Mar 07 '23 at 22:35
  • @IntrepidMan I think you're right _so long as_ you have already have a method to test for the existent of the keyword. But if, say, you loop though column A, then each value of the iterator can be co-related to the equivalent row number. So, then you just need an `if` to test for the match, and assign a value in Column B based on the iterator value. – Tedinoz Mar 07 '23 at 22:43
  • I need more information to answer your question. Please consider creating an example to highlight your question. Something visual always helps. – Cooper Mar 07 '23 at 22:43
  • Related question: [Google Script to see if text contains a value](https://stackoverflow.com/q/20527670/1330560). There are several answers here, some updated only recently. – Tedinoz Mar 07 '23 at 22:45
  • Ok I created an example...would be very grateful for any help to complete the script. – IntrepidMan Mar 13 '23 at 16:07
  • Ok I updated to include a visual and some code that I think will get me started. Would be very grateful for help. – IntrepidMan Mar 13 '23 at 17:41

0 Answers0