Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

how to search in spreadsheet using google apps script?

$
0
0

I have a reading log in a spreadsheet. Column 3 is the book name, 4 is the start page, and 5 is the end page. I want to make a script that could find the current book name in the reading log, then offset(0,2).getValue() to get the end page, and put it next to the active cell in column 3.This is what I try:

var s = e.source.getActiveSheet();var r = e.source.getActiveCell();if (r.getColumn() == "3" && r.getValue() != "") {e.range.offset(0,1).setValue(SpreadsheetApp.getActive().createTextFinder(r.getValue()).findPrevious().offset(0,2).getValue())}

However, this script doesn't work. It doesn't fill in anything at all. Does the script really search for anything? Or the way I get value is incorrect?


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>