Download the PHP package alepane21/php-google-spreadsheet-client without Composer
On this page you can find all versions of the php package alepane21/php-google-spreadsheet-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alepane21/php-google-spreadsheet-client
More information about alepane21/php-google-spreadsheet-client
Files in alepane21/php-google-spreadsheet-client
Package php-google-spreadsheet-client
Short Description Google Spreadsheet PHP Client (forked to work on PHP 5.2.1+)
License Apache-2.0
Homepage https://github.com/alepane21/php-google-spreadsheet-client
Informations about the package php-google-spreadsheet-client
Introduction
This library provides a simple interface to the Google Spreadsheet API. It's a fork of https://github.com/asimlqt/php-google-spreadsheet-client changed to be compatible with PHP 5.2.1+.
There are a couple of important things to note.
- This library requires a valid OAuth access token to work but does not provide any means of generating one. The Google APIs Client Library for PHP has all the functionality required for for generating and refreshing tokens so it would have been a waste of time duplicating the official google library.
- You can not create spreadsheets using this (PHP Google Spreadsheet Client) library, as creating spreadsheets is not part of the Spreadsheet API and the functionality already exists in the official Google Client Library.
I strongly recommend you read through the official Google Spreadsheet API documentation to get a grasp of the concepts.
Usage
Installation
Using composer is the recommended way to install it.
1 - Add "alepane21/php-google-spreadsheet-client" as a dependency in your project's composer.json file.
2 - Download and install Composer.
3 - Install your dependencies.
4 - Require Composer's autoloader.
Bootstrapping
The first thing you will need to do is initialize the service request factory:
Retrieving a list of spreadsheets
SpreadsheetFeed implements ArrayIterator so you can iterate over it using a foreach loop or you can retrieve a single spreadsheet by name.
Retrieving a list of worksheets
You can retrieve a list of worksheets from a spreadsheet by calling the getWorksheets() method.
You can loop over each worksheet or get a single worksheet by title.
Adding a worksheet
The only required parameter is the worksheet name, The row and column count are optional. The default value for rows is 100 and columns is 10.
Deleting a worksheet
Working with list-based feeds
Retrieving a list-based feed
Once you have a list feed you can loop over each entry.
The getValues() method returns an associative array where the keys are the column names and the values are the cell content.
Adding a list row
Updating a list row
Adding headers to a new worksheet
The Google Spreadsheet API does not allow you to update a list row if headers are not already assigned. So, when you create a new worksheet, before you can add data to a worksheet using the 'Adding/Updating a list row' methods above, you need to add headers.
To add headers to a worksheet, use the following: