Created
April 26, 2023 14:57
-
-
Save ochilab/8aa8e6d17763e447b56daafc36d16777 to your computer and use it in GitHub Desktop.
GAS:特定の列のデータを探して、その行のデータを返す
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
/** | |
* keyword: 検索したいキーワード | |
* keywordColumn:検索する列 | |
* outputColumn: 出力する列 | |
*/ | |
function searchSheet(keyword,keywordColumn,outputColumn) { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("シート1"); | |
var data = sheet.getRange(1,keywordColumn,3).getValues(); | |
var result = ""; | |
console.log("data="+data); | |
for (var i = 0; i < data.length; i++) { | |
if (data[i] == keyword) { | |
result=getData(i+1,outputColumn); | |
console.log("find:"+result); | |
break; | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment