GAS初心者です。GASにおいて同列内の複数セルの中から特定の文字列より前を削除したいのですがどうすればいいでしょうか?
列1 | 列2 |
---|---|
abcde=fg | fg |
asfgde=orange | orange |
jhddthyjde=apple | apple |
このような感じで、de=
より前の文字を削除してそれより後の文字列だけを表示したいです。
実際に書いたコードは、
JavaScript
1function myFunction() { 2 const ss = SpreadsheetApp.getActiveSpreadsheet(); 3 let sheetName = '抽出' 4 const sheet = ss.getSheetByName(sheetName); 5 const lastRow = sheet.getLastRow(); 6 let status_list=sheet.getRange(1,1,lastRow,1).getValues(); 7 const a = "de="; 8 const b = status_list.slice(status_list.indexOf(a)) 9 sheet.getRange(1,2,lastRow,1).setValues(b); 10 11 console.log(b); 12 13}
で、次のようなエラーが出ました。
Exception: The number of rows in the data does not match the number of rows in the range.
二次元配列に対して、出力しているb
の値が1個だからだと思うのですがそれをどううまく表示させればいいかわかりません。
ご教授いただけますと幸いです。

回答1件
あなたの回答
tips
プレビュー