PHPackages                             exs/googlesheets-bundle - 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. [API Development](/categories/api)
4. /
5. exs/googlesheets-bundle

ActiveSymfony-bundle[API Development](/categories/api)

exs/googlesheets-bundle
=======================

This bundle manages Google Spreadsheets sheet operations using Google api.

v0.2.1(8y ago)13182MITPHPPHP &gt;=5.3.9

Since Apr 23Pushed 7y ago8 watchersCompare

[ Source](https://github.com/ExSituMarketing/EXS-GoogleSheetsBundle)[ Packagist](https://packagist.org/packages/exs/googlesheets-bundle)[ Docs](https://github.com/ExSituMarketing/EXS-GoogleSheetsBundle)[ RSS](/packages/exs-googlesheets-bundle/feed)WikiDiscussions master Synced 1mo ago

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

EXS-GoogleSheetsBundle
======================

[](#exs-googlesheetsbundle)

Very simple wrapper for Google sheets integration

### What is this bundle doing ?

[](#what-is-this-bundle-doing-)

This bundle provides basic Google API SpreadSheets Sheets Service methods as Symfony services.
Methods: Get|Create|Update|Clear|Delete

### Installing the # EXS-GoogleSheetsBundle in a Symfony project

[](#installing-the--exs-googlesheetsbundle-in-a-symfony-project)

Edit composer.json file:

```
//composer.json
//...
"require": {
    //other bundles
    "exs/googlesheets-bundle": "^0.1"
},
```

Save the file and have composer require the project via the command line:

```
composer require exs/simple-mongo-bundle
```

Update the app/AppKernel.php

```
//app/AppKernel.php
//...
public function registerBundles()
{
    $bundles = array(
    //Other bundles
    new EXS\GoogleSheetsBundle\EXSGoogleSheetsBundle(),
);
```

### Usage

[](#usage)

#### Configuration

[](#configuration)

1. Set your Google project and get the client secret file.
    [Click here to obtain your client secret and set project application name](https://developers.google.com/sheets/api/quickstart/php)
2. Save your client secret file as 'client\_secret.json' in your project.
3. Add the client secret file location, project application name and credential location in the Symfony config file

```
exs_google_sheets:
    application_name: 'Google Sheets API'
    credentials: '%kernel.root_dir%/config/sheets.googleapis.com.json'
    client_secret: '%kernel.root_dir%/config/client_secret.json'
```

Your credentials will be create by the bundle once you set the file location in the bundle.
Default location: '/Credentials/sheets.googleapis.com.json'

#### Create the access token

[](#create-the-access-token)

Create the access token for google api.

1. Execute the service via the command line.
    The service will provide you the link to get a verification code.

```
app/console googlesheets:execute --function=token
```

2. Copy the verification code from the link then enter it in the command line.

#### Inputs

[](#inputs)

id: Spreadsheets id
title: sheet(tab) title
header: number of rows for header.
data: 2 dimensional array for grid data.

```
$data = [
    [ COL1_HEADER, COL2_HEADER, ...],
    [ ROW1COL1_CELL_VALUE, ROW1COL2_CELL_VALUE, ...],
    [ ROW1COL2_CELL_VALUE, ROW2COL2_CELL_VALUE, ...],
    ....
];
```

#### Methods

[](#methods)

##### SETUP(Common for all methods).

[](#setupcommon-for-all-methods)

Inject GoogleSheetsApiService or obtain it from the container.

ex) Set up an api client with the spreadsheets id that you want to manage.

```
$service = $this->getContainer()->get('exs_google_sheets.sheets_service');
$service->setSheetServices(YOUR_SPREADSHEETS_ID_HERE);
```

##### GET

[](#get)

Get an existing spreadsheets

```
$spreadsheets = $service->getGoogleSpreadSheets();
```

##### CREATE

[](#create)

Create the new sheet in Google Spreadsheets.
Return: Number of data rows that are inserted to the new sheet.
If you call the function without data, it will create an empty sheet.

ex) Create the new sheet with data

```
$sheetTitle = 'my test sheet';
$data = [
    [ COL1_HEADER, COL2_HEADER, ...],
    [ ROW1COL1_CELL_VALUE, ROW1COL2_CELL_VALUE, ...],
    ....
];
$response = $service->createNewSheet($sheetTitle, $data);
```

##### UPDATE

[](#update)

Update the existing spreadsheets sheet.
Return: Number of data rows that are updated to the sheet.

If you wants to update only cell values, not the header, define number of rows for the header.
ex) Update grid data values only.

```
$header = 1;
$sheetTitle = 'my test sheet';
$data = [
    [ ROW1COL1_CELL_VALUE, ROW1COL2_CELL_VALUE, ...],
    [ ROW2COL1_CELL_VALUE, ROW2COL2_CELL_VALUE, ...],
    ....
];
$response = $service->updateSheet($sheetTitle, $data, $header);
```

##### CLEAR

[](#clear)

Clear the entire sheet values.
Return: number of rows that are cleared.

```
$sheetTitle = 'my test sheet';
$response = $service->clearSheetByTitle($sheetTitle);
```

##### DELETE

[](#delete)

Delete the existing sheet in the spreadsheets.
Return: Boolean

```
$sheetTitle = 'my test sheet';
$response = $service->deleteSheetByTitle($sheetTitle);
```

###### Example

[](#example)

Create the new sheet with header then update it with data

```
// setup the service
$service = $this->getContainer()->get('exs_google_sheets.sheets_service');
$service->setSheetServices(YOUR_SPREADSHEETS_ID_HERE);

// create the sheet
$sheetTitle = 'my test sheet';
$data = [
    [ COL1_HEADER, COL2_HEADER, COL3_HEADER]
];
$service->createNewSheet($sheetTitle, $data);

// update grid data
$header = 1;
$data = [
    [ ROW1COL1_CELL_VALUE, ROW1COL2_CELL_VALUE, ROW1COL3_CELL_VALUE],
    [ ROW2COL1_CELL_VALUE, ROW2COL2_CELL_VALUE, ROW2COL3_CELL_VALUE],
    [ ROW3COL1_CELL_VALUE, ROW3COL2_CELL_VALUE, ROW3COL3_CELL_VALUE],
    [ ROW4COL1_CELL_VALUE, ROW4COL2_CELL_VALUE, ROW4COL3_CELL_VALUE]
];
$service->updateSheet($sheetTitle, $data, $header);
```

#### Contributing

[](#contributing)

Anyone and everyone is welcome to contribute.

If you have any questions or suggestions please [let us know](http://www.ex-situ.com/).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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 ~4 days

Total

3

Last Release

2928d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af284ff600087e33c35e00252ade1cc1dc3987f969661b91b036254dbe4bbb9c?d=identicon)[rumpranger](/maintainers/rumpranger)

---

Tags

apibundlegoogleSymfony2operationspreadshhets

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/exs-googlesheets-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/exs-googlesheets-bundle/health.svg)](https://phpackages.com/packages/exs-googlesheets-bundle)
```

###  Alternatives

[eko/googletranslatebundle

A Symfony bundle to deals with Google Translate API

4337.1k](/packages/eko-googletranslatebundle)[mediafigaro/google-analytics-api-symfony

Google Analytics API v4 Symfony

46177.7k](/packages/mediafigaro-google-analytics-api-symfony)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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