PHPackages                             stopsopa/google-spreadsheets-api-extension - 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. stopsopa/google-spreadsheets-api-extension

ActiveLibrary

stopsopa/google-spreadsheets-api-extension
==========================================

My own approach to manipulating data in Google Spreadsheets

v1.1.0(10y ago)017MITPHP

Since Apr 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/stopsopa/google-spreadsheets-api-extension)[ Packagist](https://packagist.org/packages/stopsopa/google-spreadsheets-api-extension)[ RSS](/packages/stopsopa-google-spreadsheets-api-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/8da3aee3b8f6d667b2475a1248b483455db16c6ef9db08f06ecd0357ede26177/68747470733a2f2f7472617669732d63692e6f72672f73746f70736f70612f676f6f676c652d7370726561647368656574732d6170692d657874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/stopsopa/google-spreadsheets-api-extension)[![Latest Stable Version](https://camo.githubusercontent.com/4e230e3ecd44251ae60e788bccba063b5be05d03c9640984b859384b4d482170/68747470733a2f2f706f7365722e707567782e6f72672f73746f70736f70612f676f6f676c652d7370726561647368656574732d6170692d657874656e73696f6e2f762f737461626c65)](https://packagist.org/packages/stopsopa/google-spreadsheets-api-extension)[![Coverage Status](https://camo.githubusercontent.com/76c2db29b978a20f9dbbb0a32553eafec352033d8b72c8ed798f04c7f952e7fa/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73746f70736f70612f676f6f676c652d7370726561647368656574732d6170692d657874656e73696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/stopsopa/google-spreadsheets-api-extension?branch=master)[![License](https://camo.githubusercontent.com/51fe745f1ed8bf9026be236597e492489b5319d5e5f5817ad45f8ed300936cbb/68747470733a2f2f706f7365722e707567782e6f72672f73746f70736f70612f676f6f676c652d7370726561647368656574732d6170692d657874656e73696f6e2f6c6963656e7365)](https://packagist.org/packages/stopsopa/google-spreadsheets-api-extension)

DEPRECATED
==========

[](#deprecated)

Created in 2016 - quite old now and not maintained.

stopsopa/google-spreadsheets-api-extension
==========================================

[](#stopsopagoogle-spreadsheets-api-extension)

Instalation
-----------

[](#instalation)

Follow packagist instructions: [Packagist](https://packagist.org/packages/stopsopa/google-spreadsheets-api-extension)

Setup access to google spreadsheet documents
--------------------------------------------

[](#setup-access-to-google-spreadsheet-documents)

First You need to generate credentials in [Google API Console](https://console.developers.google.com) and setup **Service account keys** (read [more](https://support.google.com/cloud/answer/6158849?hl=en#serviceaccounts)). After that you recieve file '.p12' which is a private key and special e-mail address (eq: ) that you should use to give access to api to specific spreadsheets in google-drive.

Setup this library
------------------

[](#setup-this-library)

```
use Stopsopa\GoogleSpreadsheets\Services\GoogleSpreadsheets;

$service = new GoogleSpreadsheets();

$service->setupByServiceAccountKey(
    'pathtofile.p12',
    'applicationname@applicationname.iam.gserviceaccount.com'
);

```

... and now you are ready to go.

Api
===

[](#api)

Most of methods is pretty self-explanatory so normally you can explore them through IDE or just by exploring returned data structures (especially if you read [terminology](https://developers.google.com/google-apps/spreadsheets/#terminology_used_in_this_guide) used in Sheets API), they don't need to be explained here in details, but it is also good thing to list them here. It is also good idea to see [tests](https://github.com/stopsopa/google-spreadsheets-api-extension/blob/master/Tests/GoogleSpreadsheetsTest.php) starting from method **testFindWorksheets**.

Methods of GoogleSpreadsheets class
-----------------------------------

[](#methods-of-googlespreadsheets-class)

Method with default parametersReturned typeAdditional description$service-&gt;findSpreadsheets($rawResponse = false);array$service-&gt;findWorksheets($key, $rawResponse = false);array$service-&gt;getWorksheetMetadata($key, $wid);array$service-&gt;updateWorksheetMetadata($key, $wid, $title = null, $rows = null, $cols = null);array$service-&gt;findWorksheetData($key, $wid, $rawResponse = false, $filter = array());array$service-&gt;deleteWorksheet($key, $wid);array$service-&gt;update($key, $wid, $data);array[doc](https://github.com/stopsopa/google-spreadsheets-api-extension#method-googlespreadsheets-update)$service-&gt;findFirstFreeRowForData($key, $wid);int (1 indexed)$service-&gt;getList($key, $wid);[GoogleSpreadsheetsList](https://github.com/stopsopa/google-spreadsheets-api-extension/blob/master/Services/GoogleSpreadsheetsList.php)Methods of GoogleSpreadsheetsList class
---------------------------------------

[](#methods-of-googlespreadsheetslist-class)

Read more about [list based feed](https://developers.google.com/google-apps/spreadsheets/data#work_with_list-based_feeds).

Method with default parametersReturned typeAdditional description$list-&gt;add($data);array[doc](https://github.com/stopsopa/google-spreadsheets-api-extension/blob/master/README.md#method-googlespreadsheetslist-add)$list-&gt;update($row, $data);array$row is 1 indexed, $data format like above$list-&gt;get($filters = null);array$filters format see [this](https://github.com/stopsopa/google-spreadsheets-api-extension#filter).
Usually use only min-row, max-row.Commonly used parameters
------------------------

[](#commonly-used-parameters)

### $rawResponse:

[](#rawresponse)

Many of this methods has special parameter **$rawResponse**, setting up this to true turns returned data structure to raw form, just like it's comes from google api. But in most cases it is better to leave this parameter as is and get more consist and better to iterate through data structure at the output of this methods.

$key
----

[](#key)

You can find the key in the spreadsheet URL (bolded in below example).

https://docs.google.com/spreadsheets/d/**1IAP4HOacD4Az6q\_PFfxxxxxxxxxxxxxxxx9KBX-IMO25s**/edit?usp=sharing

$wid
----

[](#wid)

This is unique identifier for each worksheet in spreadsheet, You can get these ids by using method **findWorksheets**.

$filter
-------

[](#filter)

This parameter is used to fetch specific rows or columns ranges from worksheet, eq:

```
  $result = $service->findWorksheetData($key, $wid, false, array(
    'max-col' => 4,
    'max-row' => 3
  ));

```

For more informations see in google api [Fetch specific rows or columns](https://developers.google.com/google-apps/spreadsheets/data#fetch_specific_rows_or_columns).

Other details
-------------

[](#other-details)

### Method GoogleSpreadsheets-&gt;update()

[](#method-googlespreadsheets-update)

```
    $service->update($key, $wid, array(
        'A1' => "Name",
        'B1' => "Surname",
        'C1' => "Age",
        'D1' => "Weight",
        'E1' => "Height",
        'A2' => "Something else... ",
        'R2C5' => "And again...",
        'R3C2' => '' // empty string to delete value from cell
    ));

```

Using this method you can use two types of [positioning notations](https://developers.google.com/google-apps/spreadsheets/data#work_with_cell-based_feeds). Using method *update* you can set/update/delete data in many cells by one [batch request](https://developers.google.com/google-apps/spreadsheets/data#update_multiple_cells_with_a_batch_request).

To convert in both ways these two types of formats use [this](https://github.com/stopsopa/google-spreadsheets-api-extension/blob/master/Utils/CellConverter.php) lib.

### Method GoogleSpreadsheetsList-&gt;add()

[](#method-googlespreadsheetslist-add)

```
    $list->add(array(
        'Name' => 'John',
        'Surname' => 'Smith',
        'Age' => '35'
    ));

```

To read more about basic assumptions that describes working with list based feeds go [here](https://developers.google.com/google-apps/spreadsheets/data#work_with_list-based_feeds).

License
-------

[](#license)

The MIT License (MIT) Copyright (c) 2016 Szymon Działowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 81.8% 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 ~5 days

Total

4

Last Release

3667d ago

Major Versions

v0.0.2 → v1.0.02016-04-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3743506?v=4)[Szymon Dzialowski](/maintainers/stopsopa)[@stopsopa](https://github.com/stopsopa)

---

Top Contributors

[![grytysek](https://avatars.githubusercontent.com/u/875810?v=4)](https://github.com/grytysek "grytysek (36 commits)")[![stopsopa](https://avatars.githubusercontent.com/u/3743506?v=4)](https://github.com/stopsopa "stopsopa (8 commits)")

### Embed Badge

![Health badge](/badges/stopsopa-google-spreadsheets-api-extension/health.svg)

```
[![Health](https://phpackages.com/badges/stopsopa-google-spreadsheets-api-extension/health.svg)](https://phpackages.com/packages/stopsopa-google-spreadsheets-api-extension)
```

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

81733.7k](/packages/flow-php-flow)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1225.0k10](/packages/fleetbase-core-api)[chameleon-system/chameleon-base

The Chameleon System core.

1026.5k3](/packages/chameleon-system-chameleon-base)[voidagency/vactory_starter_kit

Vactory is a custom Drupal profile which is developed and released by VOID Agency.

1019.7k](/packages/voidagency-vactory-starter-kit)

PHPackages © 2026

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