0
0

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.

スプレッドシートの値を配列で取得

Posted at

全部を取得

2次元配列になる

.getDataRange().getValues()

const spreadsheet = SpreadsheetApp.openById('xxxxxxxxxxxxxxxxxxx')
const sheet = spreadsheet.getSheetByName('シート1')

// 取得した配列を表示
console.log(sheet.getDataRange().getValues())

// A1セルを表示
console.log(sheet.getDataRange().getValues()[0][0])

範囲指定

2次元配列になる

.getRange(1,1,6,3).getValues()

A1からC6まで取得する場合

// getRange(1行目の, 1列目から, 6行目の, 3列目まで)
sheet.getRange(1,1,6,3).getValues();

// or

sheet.getRange("A1:C6").getValues()
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?