Created
October 18, 2019 11:30
-
-
Save ochilab/c26ba8829b5229fe690cdb3fd723eb78 to your computer and use it in GitHub Desktop.
Google Sheetのセルを線形探索する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keyword ="hogehoge"; | |
var range = targetSheet.getRange(1, 2, targetNum); //2列目のデータを範囲とする | |
var target = range.getDisplayValues();//列のデータを取得 | |
//なぜかtargetが文字列配列とならないので、下記の処理で文字列配列に変換 | |
var targetList = target.toString().split(","); | |
var pos = targetList.indexOf(keyword); //ここで一発検索 | |
if(pos==-1){ | |
// 検索失敗 | |
}else{ | |
//検索成功 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment