yish/laravel-googlespreadsheet

This package is abandoned and no longer maintained. No replacement package was suggested.

Google spreadsheet transforms to json and storing to file with laravel.

1.1.1 2020-09-09 05:05 UTC

This package is auto-updated.

Last update: 2021-02-15 16:37:44 UTC


README

Latest Version on Packagist Build Status Total Downloads

Google spreadsheet transforms to json and storing to file with laravel.

Installation

You can install the package via composer:

composer require yish/laravel-googlespreadsheet

If you need to set access type, you can publish config.

This package depends on pulkitjalan/google-apiclient, so you need to publish pulkitjalan/google-apiclient config and setup.

    'service' =>  [
        'enabled' => true,
        'file' => 'your-service-account-json-file-path',
    ],

You need to check your service account and configs are all done.

  1. google console
  2. service account
  3. download credential.json
  4. enabled sheet api
  5. paste service account to sheet account permission

Usage

// $sheet_id = your google spreadsheet id.
// $range = you need column range, like 'Class Data!A2:E', if you use chinese, using double quote. "'首頁'!A2:E".
// $title = you want to set which one be a title key.
// $unset = you want to unset which columns. 
// $scope = Google_Service_Sheets::SPREADSHEETS_READONLY.
GoogleSpreadSheet::json($sheet_id, $range, $title = 0, $unset = [], $scope = null)
GoogleSpreadSheet::json($sheet_id, 'index!A2:E', 0, [1, 2]) // get the sheet and set 0 column to be title key, unset column 1 and column 2.
// You can chain the storeAs.
GoogleSpreadSheet::json($sheet_id, 'index!A2:E', 0, [1, 2])->storeAs($path, $disk = 'public')
// Or you can use feed.
GoogleSpreadSheet::feed($sheet_id, $sheet = 1, $format = 'json')

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email mombuartworks@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.