1
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.

【PHP】Google Sheet APIで、対象のスプレッドシートの特定範囲の最終行を取得する

Posted at

GASだと簡単にできるけども、SheetAPIだとすんなり取れなかったのでメモ

spreadsheetTest.php
// $this->spreadsheetIdにて特定したスプレッドシートのシート1のA3からI列までの範囲で、入力のある部分を情報として取得
$rowsInfo = $this->service->spreadsheets_values->get($this->spreadsheetId, 'シート1!A3:I');
// 上記のカウントが最終行になるが、項目などを指定している場合は以下の$lastRowに項目分の行をプラスする必要がある
$lastRow = count($row) + 2;
1
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
1
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?