fathilarhm / google-sheets-collection
This package is abandoned and no longer maintained.
No replacement package was suggested.
A simple Laravel packages to create a beautiful data collection from the Google Spreadsheet.
dev-master
2023-03-14 15:13 UTC
This package is not auto-updated.
Last update: 2023-03-16 18:08:06 UTC
README
A simple Laravel package to create beautiful collection data from Google Sheets URL.
<?php use namespace Fathilarham\GsheetsCollection; // GsheetsCollection::get($url)->get($sheet = 1); $url = 'https://docs.google.com/spreadsheets/d/1zQIz2xmAGjsvlDhECrvMxbnMmjmLhuWWIOYn2dar18M/edit?usp=sharing'; $data = GsheetsCollection::url($url)->get();
Installation
With Composer
$ composer require fathilarhm/google-sheets-collection
{ "require": { "fathilarhm/google-sheets-collection": "^1.0" } }
<?php require 'vendor/autoload.php'; use Fathilarham\GsheetsCollection; $url = 'https://docs.google.com/spreadsheets/d/1zQIz2xmAGjsvlDhECrvMxbnMmjmLhuWWIOYn2dar18M/edit?usp=sharing'; $data = GsheetsCollection::url($url)->get();
How to use
After installing this package to your Laravel project, you can follow this step :
- Create new Google Spreadsheet.
- Publish your Spreadsheet to the web (click 'Publish to the web' action in 'File' menu).
- Share your Spreadsheet and make it visible for public. Dont forget to copy the url.
- Place your url to this function parameter
GsheetsCollection::url($url);
- Get the data collection
GsheetsCollection::url(...)->get();
- If you want to take data from another sheet, you can add your sheet number to the second parameter of the function
GsheetsCollection::url(...)->get($sheet = 1);
- The result of
$data
would be :
[ { "id": "1", "code": "JT-001", "origin": "Pontianak", "destination": "Jakarta", "time": "3/4/2020 8:00:00" }, { "id": "2", "code": "SF-002", "origin": "Jakarta", "destination": "San Francisco", "time": "13/8/2020 9:00:00" } ]
Security contact information
To report a security vulnerability, please send an email to fathil.arham@gmail.com. I will coordinate the fix and disclosure.