2017 © Pedro Peláez
 

library laravel-google-spreadsheet

Google spreadsheet client for Laravel based off mach3ss@gmail.com

image

mitni/laravel-google-spreadsheet

Google spreadsheet client for Laravel based off mach3ss@gmail.com

  • Friday, January 13, 2017
  • by mitni455
  • Repository
  • 1 Watchers
  • 3 Stars
  • 378 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

Out of Date!!

The google API has changed, so I need to update this package

Google Spreadsheet Client for Laravel/PHP

Originally forked from mach3/google-spreadsheet.php to work with Laravel 5.x (and correct namespacing), (*1)

Google Spreadsheet Client for Laravel/PHP., (*2)

Get started

1. Get key file

  1. Log in Google Developper Console
  2. Create new project
  3. Create Service Account credentials in the project
  4. Download key file as JSON

2. Create spreadsheet

  1. Create a new spreadsheet in Google Drive
  2. Authorize the email address, which is found as "client_email" in key file, to read and edit.
  3. Save the file ID from address bar.

3.1 Composer

composer require mitni/laravel-google-spreadsheet, (*3)

This requires "google/apiclient" package, but that should be included by default., (*4)

3.2 Access by PHP

use Mitni\Google\GoogleSpreadsheet;

$client = GoogleSpreadsheet::getClient("the/path/to/credential.json");
// Get the file by file ID
$file = $client->file("XXXxxxXXXXxxxXXXX");
// Get the sheet by title
$sheet = $file->sheet("Sheet1");
// Flush all rows in the sheet
var_dump($sheet->items);

Usage

Select rows

// Array
$items = $sheet->select(array("id" => "1"));
// Closure
$items = $sheet->select(function($row){
    return (int) $row["age"] < 30;
});

Insert a new row

$sheet->insert(array(
    "name" => "John",
    "age" => 23,
    "email" => "john@example.com"
));

Update column's value

$sheet->update(
    8, // row number
    "name", // field's name (or column number as Integer)
    "Tom"
);

Get up-to-date table data

$items = $sheet->fetch(true)->items;

Save cache

$client->config(array(
    "cache" => true,
    "cache_dir" => "cache",
    "cache_expires" => 3600
));

Requirement

The Versions

13/01 2017

dev-master

9999999-dev

Google spreadsheet client for Laravel based off mach3ss@gmail.com

  Sources   Download

MIT

The Requires

 

by Avatar mach3
by Nick Mitchell

14/09 2015

v0.1.2

0.1.2.0

Google spreadsheet client

  Sources   Download

MIT

The Requires

 

by Avatar mach3

06/09 2015

v0.1.1

0.1.1.0

Google spreadsheet client

  Sources   Download

MIT

The Requires

 

by Avatar mach3

03/09 2015

v0.1.0

0.1.0.0

Google spreadsheet client

  Sources   Download

MIT

The Requires

 

by Avatar mach3