0
4

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 3 years have passed since last update.

【GAS初心者】スプレッドシートのある1列だけを抜き出したい!(GAS)

Last updated at Posted at 2020-07-29

結論(はじめから列のみの値を取る場合)

var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("シート名");
var Values_E = sheet.getRange('E2:E').getValues();//項目(E1)をのぞいたE列の値を全て取得
Logger.log(Values_E.filter(String))//空白をのぞいて表示

結論(シート全体の値を取る場合)

var targetCol = 0 // 取得したい列番号(0から数える)
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("シート名");
var vals = sheet.getDataRange().getValues(); // シート全体の値を取得
Logger.log(vals.map((line) => line[targetCol]))
}

0
4
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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?