The Laravel ecosystem just gained a major upgrade for teams that rely on Google Sheets for data workflows. Version 1.1.0 of the laravel-google-sheets package introduces features designed to reduce errors, streamline syncs, and handle API hiccups more gracefully. Whether you manage user imports, dashboard exports, or automated reporting, these tools help you work with spreadsheets more reliably.
What’s new in Laravel Google Sheets v1.1.0
The package now supports Laravel 10 through 13, ensuring compatibility with both legacy and cutting-edge applications. Key additions include diff previews for imports, multiple sync methods, dry-run validation, and built-in retry logic for temporary API failures. A new error sheet feature surfaces validation issues directly in the spreadsheet, and enhanced testing tools let developers mock spreadsheet behavior without hitting the real API.
Preview imports before they commit
One of the standout features is the ability to preview changes before merging them into your system. Developers can now run a diff check that compares a Google Sheet against an Eloquent model, separating rows into categories like new, changed, deleted, invalid, and conflicts.
use App\Models\User;
use Olamilekan\GoogleSheets\Facades\GoogleSheets;
$preview = GoogleSheets::connection('users')
->diffAgainst(User::query(), key: 'email')
->rules([
'name' => ['required', 'string'],
'email' => ['required', 'email'],
])
->preview();
$preview->counts();The response breaks down the impact:
new– Rows to be createdchanged– Rows to be updateddeleted– Rows to be removedinvalid– Rows failing validationconflicts– Rows with key mismatches
You can also refine the comparison by specifying which fields to include or exclude, making it easier to tailor the preview to your workflow’s needs.
Sync data in multiple directions
Version 1.1.0 expands sync capabilities across different data formats and sources. Developers can now move data between Google Sheets, Eloquent models, CSV files, and external APIs with dedicated methods for each scenario.
- Sync from Eloquent to Sheets:
$report = GoogleSheets::connection('users')
->syncFromModel(User::class, keyColumn: 'email', options: [
'columns' => ['name', 'email', 'role'],
'conflict' => 'app_wins',
]);- Sync from Sheets to Eloquent:
$report = GoogleSheets::connection('users')
->syncToModel(User::class, keyColumn: 'email');- Import or export CSV files:
$report = GoogleSheets::connection('users')
->importCsv(storage_path('app/users.csv'), keyColumn: 'email');
$report = GoogleSheets::connection('users')
->exportCsv(storage_path('app/users-export.csv'));- Sync API data into sheets or vice versa:
$report = GoogleSheets::connection('orders')
->syncFromApi(' keyColumn: 'order_id', options: [
'data_key' => 'data',
'headers' => ['Authorization' => 'Bearer '.$token],
]);
$report = GoogleSheets::connection('orders')
->syncToApi(');Each sync operation returns a detailed report, breaking down created, updated, and errored rows for transparency.
Handle conflicts and run dry tests
Two-way syncs now include configurable conflict resolution strategies:
app_wins– Keep local changessheet_wins– Prioritize spreadsheet dataskip– Ignore conflicting rowsfail– Stop the sync on conflicts
For command-line workflows, a new dry-run option lets teams validate imports without writing any data:
php artisan google-sheets:sync "App\\Imports\\UsersImport" users --dry-runValidation errors can also be exported directly to a dedicated error sheet, giving spreadsheet users clear visibility into issues and where to fix them.
Resilient APIs and better testing
Temporary failures in Google Sheets API calls are now handled with retry logic featuring exponential backoff and jitter. The default configuration retries three times with a 250ms initial delay, scaling up to 5 seconds between attempts. Developers can adjust these settings at runtime:
$rows = GoogleSheets::withRetries(attempts: 5, delay: 500)->all();
$rows = GoogleSheets::withoutRetries()->all();Testing has also improved. The package now ships with robust fakes that simulate spreadsheet behavior, allowing developers to test integrations without external dependencies:
use Olamilekan\GoogleSheets\Facades\GoogleSheets;
$fake = GoogleSheets::fake([
'users' => [
['name' => 'Alice', 'email' => 'alice@example.com'],
],
]);
GoogleSheets::connection('users')->appendAssoc([
['name' => 'Bob', 'email' => 'bob@example.com'],
]);
$fake->assertAppended('users', [
'name' => 'Bob',
'email' => 'bob@example.com',
]);This makes it easier to write reliable tests for spreadsheet-driven logic, especially in CI/CD pipelines.
Smooth upgrades and forward compatibility
Upgrading to v1.1.0 is seamless for existing users. Run a simple Composer update to pull in the latest changes, and publish the updated config if needed:
composer update olamilekan/laravel-google-sheets
php artisan vendor:publish --tag=google-sheets-configWith support for multiple Laravel versions and a growing suite of sync and validation tools, this release solidifies laravel-google-sheets as a go-to solution for teams that depend on Google Sheets in their daily operations. Expect future updates to focus on even deeper integrations and performance improvements as adoption grows.
AI summary
Laravel projelerinizde Google Sheets kullanımını geliştirin. Yeni v1.1.0 sürümüyle veri senkronizasyonu, hata yönetimi ve test kolaylıkları hakkında detaylı bilgiler.