yish / laravel-googlespreadsheet
Google spreadsheet transforms to json and storing to file with laravel.
Requires
- php: ^7.1
- ext-json: *
- guzzlehttp/guzzle: ^6.3
- illuminate/support: 5.8.*|^6.0|^7.0|^8.0
- pulkitjalan/google-apiclient: ^4.0
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2021-02-15 16:37:44 UTC
README
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.
- google console
- service account
- download credential.json
- enabled sheet api
- 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.