2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google SpreadSheetで表データ(Matrix)を分解して、リストデータ(row)にする変換する関数を追加する

Posted at

GASに以下の関数を定義して、

function matrix_to_rows(dataArray) {
  var resultsArray = [];
  for(var i=1;i<dataArray.length;i++){
    for(var j=1;j<dataArray[0].length;j++){
      if(dataArray[i][0] != ""){
      resultsArray.push([dataArray[i][0],dataArray[0][j], dataArray[i][j]]);
      }
    }
  }
  return resultsArray;
}
=matrix_to_rows(範囲)

とすれば、表データをqueryなどで扱いやすいリストデータに変換できます

2
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?