0
3

More than 3 years have passed since last update.

filterを使って、目的のデータのみを抽出する

Last updated at Posted at 2020-06-15

目的

スプレッドシートを二次元配列で扱う際、必要なレコードと不要なレコードをフィルタリングするために、filterを使って選別しました。

function filterPractice() {
  const IndexSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Index');
  let data_range = IndexSheet.getDataRange().getValues();
  //console.log(data_range);
  //配列の2番目要素が''の場合のみを抽出する
  let status_values = data_range.filter( function(record){return record[2] === ''});
  console.log(status_values);
}

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3