Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Use a Google Sheet as Your Laravel Database with the Google Sheets Database Driver

Last updated on by

Use a Google Sheet as Your Laravel Database with the Google Sheets Database Driver image

The Laravel Google Sheets Database Driver by AmazingBV registers a custom google-sheets connection, letting Eloquent, the query builder, and migrations read and write directly to a Google Sheet.

The mental model is simple: the spreadsheet is the database, each tab is a table, and the header row defines the columns. The rest is plumbing the package handles for you.

When this makes sense

This is not a MySQL replacement, and the package's author is upfront about that. The intended audience is teams with modest data needs: small back-office apps, prototypes, internal tools, and the kind of light integrations where reaching for MySQL or PostgreSQL feels like overkill. The clearest sign that this package is a fit is when the spreadsheet itself is already part of how the team works, non-developers want to look at or edit the data directly, the row counts stay modest, and you don't need the database to enforce relational rules for you.

If you need transactions, foreign keys, database-level constraints, or high write throughput, this is not the right pick.

Getting set up

After installing with Composer:

composer require amazingbv/laravel-google-sheets-database-driver

You'll need a service account JSON key from Google Cloud. The short version: create or pick a Google Cloud project, enable the Google Sheets API, create a service account, and download its JSON key. The package's GitHub repo walks through these steps in more detail.

With the key in hand, point Laravel at your spreadsheet ID and the credentials file in your .env:

DB_CONNECTION=google-sheets
DB_DATABASE=your-google-spreadsheet-id
GOOGLE_SHEETS_CREDENTIALS_PATH=/absolute/path/to/service-account.json

The service account's client_email (from the JSON key) needs Editor access to the spreadsheet. Then a one-time install command prepares the internal tabs the driver uses:

php artisan sheets:install

A small example

Imagine a tiny app for tracking RSVPs to a community meetup. The migration looks like a normal Laravel migration:

Schema::connection('google-sheets')->create('rsvps', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email');
$table->boolean('attending')->default(true);
$table->timestamps();
});

Run it with php artisan migrate --database=google-sheets and an rsvps tab appears in the spreadsheet, headers and all.

The model itself doesn't require anything unusual:

class Rsvp extends Model
{
protected $connection = 'google-sheets';
protected $guarded = [];
protected $casts = ['attending' => 'boolean'];
}

From there, the usual calls just work:

Rsvp::create([
'name' => 'Ada Lovelace',
'email' => 'ada@example.com',
'attending' => true,
]);
 
$confirmed = Rsvp::where('attending', true)
->orderBy('created_at')
->get();

Every write shows up in the sheet immediately, which is the whole point: the event organizer can sort, filter, and tweak the data in Google Sheets while the Laravel app keeps reading the same rows.

What you can and can't query

The driver supports a working subset of the query API rather than full SQL. You get where, whereIn, whereNull, whereLike, orderBy, limit, offset, the usual aggregates (count, sum, avg, and friends), and a simple in-memory inner join.

What you don't get: raw SQL, groupBy, having, unions, and real transactions. Laravel's DB::transaction() calls are accepted as no-ops, which keeps queue workers and framework internals happy but offers no rollback.

Migrations follow the same forgiving approach. Calls like ->unique(), ->index(), and ->foreignId()->constrained() don't fail, but Google Sheets won't enforce them either. If you depend on those guarantees, enforce them in application code.

Living with API quotas

Google Sheets has tight per-minute API quotas, so the driver puts a few guardrails in place: in-process read caching, configurable per-minute throttles, exponential-backoff retries on quota errors, and an optional Laravel cache store (file, redis, etc.) for further reduction in API calls. All of those knobs are tunable from .env, and the author includes a short troubleshooting list for when you start seeing quota errors.

The "Database Index" tab

One small detail worth calling out: the package keeps a visible Database Index tab as the first tab in the spreadsheet, with linked rows pointing at each table tab. It is a nice quality-of-life feature for anyone opening the sheet directly, and it makes the spreadsheet feel less like a black box and more like something a non-developer can navigate.

Try it out

To learn more and view the source code, head over to the package's GitHub repository.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Code Review

Get expert guidance in a few days with a Laravel code review

Visit Laravel Code Review
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift

The latest

View all →
Frontend Nation 2026 Returns June 3-4 with Laravel in the Lineup image

Frontend Nation 2026 Returns June 3-4 with Laravel in the Lineup

Read article
Larapanda: A Type-Safe Lightpanda Browser SDK for Laravel image

Larapanda: A Type-Safe Lightpanda Browser SDK for Laravel

Read article
Generate HTML Password Rules Attribute in Laravel 13.9.0 image

Generate HTML Password Rules Attribute in Laravel 13.9.0

Read article
DHH Joins Laravel Live Denmark 2026 for Fireside Chat with Taylor Otwell image

DHH Joins Laravel Live Denmark 2026 for Fireside Chat with Taylor Otwell

Read article
Model-Based Scheduling for Laravel with Cadence image

Model-Based Scheduling for Laravel with Cadence

Read article
Laravel's AI SDK adds sub-agents image

Laravel's AI SDK adds sub-agents

Read article