Download the PHP package reandimo/google-sheets-helper without Composer
On this page you can find all versions of the php package reandimo/google-sheets-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download reandimo/google-sheets-helper
More information about reandimo/google-sheets-helper
Files in reandimo/google-sheets-helper
Package google-sheets-helper
Short Description A bunch of functions to work easily with Google Sheets API
License MIT
Homepage https://github.com/reandimo/google-sheets-helper
Informations about the package google-sheets-helper
Stop wrestling with the verbose Google Sheets API. This library wraps the official Google APIs Client Library for PHP into a clean, fluent interface so you can read, write, and manage spreadsheets in just a few lines of code.
Features
| Feature | Description | |
|---|---|---|
| Read | get() getSingleCellValue() findCellByValue() |
Fetch ranges, single cells, or search by value |
| Write | appendSingleRow() append() updateSingleCell() update() |
Append rows, update cells or entire ranges |
| Sheets | addWorksheet() duplicateWorksheet() renameWorksheet() deleteWorksheet() |
Full worksheet lifecycle management |
| Style | colorRange() clearRange() |
Color cells and clear data |
| Manage | create() getSpreadsheetWorksheets() |
Create spreadsheets and list worksheets |
Requirements
- PHP >= 5.4 with CLI and JSON extension
- A Google Cloud Platform project with the Sheets API enabled
- Credentials (
credentials.json) from the Google Cloud Console
Installation
Credentials Setup
The library authenticates using two files: credentials.json (from Google Cloud Console) and token.json (generated on first auth).
Generate token.json by running from your project root:
Follow the interactive steps — this only needs to be done once.
See it in action
Quick Start
You can also pass credential paths directly to the constructor:
API Reference
Reading Data
get() — Get values from a range
getSingleCellValue(string $cell) — Get a single cell value
findCellByValue(string $searchValue) — Search for a value
Writing Data
appendSingleRow(array $row) — Append one row
append(array $rows) — Append multiple rows
updateSingleCell(string $cell, mixed $value) — Update one cell
update(array $values) — Update a range
Worksheet Management
getSpreadsheetWorksheets() — List all worksheets
addWorksheet(string $title, int $rows, int $cols) — Create a new worksheet
duplicateWorksheet(string $newName) — Duplicate a worksheet
renameWorksheet(string $oldName, string $newName) — Rename a worksheet
deleteWorksheet(string $name) — Delete a worksheet
Styling & Utilities
colorRange(array $rgb) — Set background color
clearRange() — Clear all values in a range
create(string $title) — Create a new spreadsheet
Helper::getColumnLettersIndex(string $letters) — Column letter to index
Tips
Blank cells on insert/update: Use the constant
Google_Model::NULL_VALUEto represent an empty cell.Multiple sheet instances: Create as many
Helperinstances as you need to work with different spreadsheets or worksheets simultaneously.
License
MIT License. See LICENSE for details.
Questions & Issues
Found a bug or have a suggestion? Open an issue.
Author
Renan Diaz — Working with PHP since 2017 & Google's API since 2019.