PHPackages                             lavaei/laravel-google-sheets - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. lavaei/laravel-google-sheets

ActiveLibrary

lavaei/laravel-google-sheets
============================

Google Sheets API v4

5.8.0(4y ago)013↓100%MITPHPPHP ^7.4||^8.0

Since Jun 26Pushed 4y agoCompare

[ Source](https://github.com/Lavaei/laravel-google-sheets)[ Packagist](https://packagist.org/packages/lavaei/laravel-google-sheets)[ RSS](/packages/lavaei-laravel-google-sheets/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (62)Used By (0)

Google Sheets API v4 for Laravel
================================

[](#google-sheets-api-v4-for-laravel)

[![packagist](https://camo.githubusercontent.com/c415e11b92be82c3e77fb9d63bf5909289935bd3bb6722bd80cdf520e5de4ff5/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f7265766f6c7574696f6e2f6c61726176656c2d676f6f676c652d736865657473)](https://packagist.org/packages/revolution/laravel-google-sheets)[![Maintainability](https://camo.githubusercontent.com/539c8412e2a6c28fc2dc4f9c8c4d71fe2112184998fbf16993b37f7eeb029940/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32306664643163613866333733376333383364662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/kawax/laravel-google-sheets/maintainability)[![Test Coverage](https://camo.githubusercontent.com/14827979d825c19d88c90ae55e703c4964317e296fbc5e549d234a277ef54daa/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32306664643163613866333733376333383364662f746573745f636f766572616765)](https://codeclimate.com/github/kawax/laravel-google-sheets/test_coverage)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Laravel &gt;= 6.0

Versioning
----------

[](#versioning)

- Basic : semver
- Drop old PHP or Laravel version : `+0.1`. composer should handle it well.
- Support only latest major version (`master` branch), but you can PR to old branches.

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require revolution/laravel-google-sheets

```

### Laravel

[](#laravel)

1. This package depends on
2. Run `php artisan vendor:publish --provider="PulkitJalan\Google\GoogleServiceProvider" --tag="config"` to publish the google config file

    ```
     // config/google.php

     // OAuth
     'client_id'        => env('GOOGLE_CLIENT_ID', ''),
     'client_secret'    => env('GOOGLE_CLIENT_SECRET', ''),
     'redirect_uri'     => env('GOOGLE_REDIRECT', ''),
     'scopes'           => [\Google\Service\Sheets::DRIVE, \Google\Service\Sheets::SPREADSHEETS],
     'access_type'      => 'online',
     'approval_prompt'  => 'auto',
     'prompt'           => 'consent', //"none", "consent", "select_account" default:none

     // or Service Account
     'file'    => storage_path('credentials.json'),
     'enable'  => env('GOOGLE_SERVICE_ENABLED', true),

    ```
3. Get API Credentials from
    Enable `Google Sheets API`, `Google Drive API`.
4. Configure .env as needed

    ```
     GOOGLE_APPLICATION_NAME=
     GOOGLE_CLIENT_ID=
     GOOGLE_CLIENT_SECRET=
     GOOGLE_REDIRECT=
     GOOGLE_DEVELOPER_KEY=
     GOOGLE_SERVICE_ENABLED=
     GOOGLE_SERVICE_ACCOUNT_JSON_LOCATION=

    ```

Demo
----

[](#demo)

-
-

Another Google API Series.

-
-

Usage
-----

[](#usage)

idnamemail1name1mail12name2mail2[https://docs.google.com/spreadsheets/d/{spreadsheetID}/](https://docs.google.com/spreadsheets/d/%7BspreadsheetID%7D/)...

### Basic Laravel Usage

[](#basic-laravel-usage)

```
use Sheets;

$user = $request->user();

$token = [
      'access_token'  => $user->access_token,
      'refresh_token' => $user->refresh_token,
      'expires_in'    => $user->expires_in,
      'created'       => $user->updated_at->getTimestamp(),
];

// all() returns array
$values = Sheets::setAccessToken($token)->spreadsheet('spreadsheetId')->sheet('Sheet 1')->all();
// [
//   ['id', 'name', 'mail'],
//   ['1', 'name1', 'mail1'],
//   ['2', 'name1', 'mail2']
// ]
```

### Basic Non-Laravel Usage

[](#basic-non-laravel-usage)

```
use Google\Client;
use Revolution\Google\Sheets\Sheets;

$client = new Client();
$client->setScopes([Google\Service\Sheets::DRIVE, Google\Service\Sheets::SPREADSHEETS]);
// setup Google Client
// ...

$service = new \Google\Service\Sheets($client);

$sheets = new Sheets();
$sheets->setService($service);

$values = $sheets->spreadsheet('spreadsheetID')->sheet('Sheet 1')->all();
```

### Get a sheet's values with the header as the key

[](#get-a-sheets-values-with-the-header-as-the-key)

```
// get() returns Laravel Collection
$rows = Sheets::sheet('Sheet 1')->get();

$header = $rows->pull(0);
$values = Sheets::collection($header, $rows);
$values->toArray()
// [
//   ['id' => '1', 'name' => 'name1', 'mail' => 'mail1'],
//   ['id' => '2', 'name' => 'name2', 'mail' => 'mail2']
// ]
```

Blade

```
@foreach($values as $value)
  {{ data_get($value, 'name') }}
@endforeach
```

### Using A1 Notation

[](#using-a1-notation)

```
$values = Sheets::sheet('Sheet 1')->range('A1:B2')->all();
// [
//   ['id', 'name'],
//   ['1', 'name1'],
// ]
```

### Updating a specific range

[](#updating-a-specific-range)

```
Sheets::sheet('Sheet 1')->range('A4')->update([['3', 'name3', 'mail3']]);
$values = Sheets::range('')->all();
// [
//   ['id', 'name', 'mail'],
//   ['1', 'name1', 'mail1'],
//   ['2', 'name1', 'mail2'],
//   ['3', 'name3', 'mail3']
// ]
```

### Append a set of values to a sheet

[](#append-a-set-of-values-to-a-sheet)

```
// When we don't provide a specific range, the sheet becomes the default range
Sheets::sheet('Sheet 1')->append([['3', 'name3', 'mail3']]);
$values = Sheets::all();
// [
//   ['id', 'name', 'mail'],
//   ['1', 'name1', 'mail1'],
//   ['2', 'name1', 'mail2'],
//   ['3', 'name3', 'mail3']
// ]
```

### Append a set of values with keys

[](#append-a-set-of-values-with-keys)

```
// When providing an associative array, values get matched up to the headers in the provided sheet
Sheets::sheet('Sheet 1')->append([['name' => 'name4', 'mail' => 'mail4', 'id' => 4]]);
$values = Sheets::all();
// [
//   ['id', 'name', 'mail'],
//   ['1', 'name1', 'mail1'],
//   ['2', 'name1', 'mail2'],
//   ['3', 'name3', 'mail3'],
//   ['4', 'name4', 'mail4'],
// ]
```

### Add a new sheet

[](#add-a-new-sheet)

```
Sheets::spreadsheetByTitle($title)->addSheet('New Sheet Title');
```

### Deleting a sheet

[](#deleting-a-sheet)

```
Sheets::spreadsheetByTitle($title)->deleteSheet('Old Sheet Title');
```

### Specifying query parameters

[](#specifying-query-parameters)

```
$values = Sheets::sheet('Sheet 1')->majorDimension('DIMENSION_UNSPECIFIED')
                                  ->valueRenderOption('FORMATTED_VALUE')
                                  ->dateTimeRenderOption('SERIAL_NUMBER')
                                  ->all();
```

Use original Google\_Service\_Sheets
------------------------------------

[](#use-original-google_service_sheets)

```
$sheets->spreadsheets->...
$sheets->spreadsheets_sheets->...
$sheets->spreadsheets_values->...

Sheets::getService()->spreadsheets->...
```

see

LICENSE
-------

[](#license)

MIT
Copyright kawax

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 87.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~76 days

Total

60

Last Release

1544d ago

Major Versions

1.0.3 → 2.0.02016-08-14

2.0.x-dev → 3.0.02017-09-05

3.2.13 → 4.0.02019-02-27

3.0.x-dev → 4.0.22019-05-25

4.0.x-dev → 5.0.02019-09-07

PHP version history (9 changes)1.0.0PHP &gt;=5.6

1.0.3PHP &gt;=5.5.9

2.3.2PHP ^5.6.4 || ^7.0

3.0.0PHP &gt;=7.0.0

4.0.0PHP &gt;=7.1.3

5.0.0PHP ^7.2

5.0.1PHP ^7.2||^8.0

5.5.0PHP ^7.3||^8.0

5.7.0PHP ^7.4||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/869df92fa674cfffc4cbd1fe3007553014eb42c6f367238992b4e033d3b53189?d=identicon)[Lavaei](/maintainers/Lavaei)

---

Top Contributors

[![kawax](https://avatars.githubusercontent.com/u/1502086?v=4)](https://github.com/kawax "kawax (123 commits)")[![calebanthony](https://avatars.githubusercontent.com/u/5722251?v=4)](https://github.com/calebanthony "calebanthony (10 commits)")[![Lavaei](https://avatars.githubusercontent.com/u/10476537?v=4)](https://github.com/Lavaei "Lavaei (3 commits)")[![awoyele](https://avatars.githubusercontent.com/u/16243076?v=4)](https://github.com/awoyele "awoyele (1 commits)")[![adammatysiak](https://avatars.githubusercontent.com/u/25105267?v=4)](https://github.com/adammatysiak "adammatysiak (1 commits)")[![r15ch13](https://avatars.githubusercontent.com/u/432127?v=4)](https://github.com/r15ch13 "r15ch13 (1 commits)")[![timbroder](https://avatars.githubusercontent.com/u/121503?v=4)](https://github.com/timbroder "timbroder (1 commits)")

---

Tags

laravelgooglesheets

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lavaei-laravel-google-sheets/health.svg)

```
[![Health](https://phpackages.com/badges/lavaei-laravel-google-sheets/health.svg)](https://phpackages.com/packages/lavaei-laravel-google-sheets)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[revolution/laravel-google-sheets

Google Sheets API v4

4483.1M6](/packages/revolution-laravel-google-sheets)[thujohn/analytics

Google Analytics for Laravel 4

113108.7k1](/packages/thujohn-analytics)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[schulzefelix/laravel-search-console

A Laravel package to retrieve data from Google Search Console

5037.8k1](/packages/schulzefelix-laravel-search-console)[scottybo/laravel-google-my-business

A package for Laravel which implements the Google My Business API

3360.3k](/packages/scottybo-laravel-google-my-business)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
