How to Move Spreadsheet Data Into a Laravel App With Filament.

A practical Laravel Filament CSV import guide covering column mapping, validation, safe updates and testing before moving spreadsheet data into an app.

A product spreadsheet can carry a business for a long time. Moving it into a Laravel app is worthwhile when staff need to find, update and review the same records in one place. Filament’s CSV import action gives you a starting point for bringing the existing data across.

1. Define the columns and the matching key

Start with a small CSV exported from the spreadsheet. Here is a sample product file with made-up records.

sku,name,unit_price_npr
BAG-001,Canvas tote,750.00
BAG-002,Travel pouch,450.00

Choose a stable key such as sku. Keep it as text in the spreadsheet, particularly if identifiers contain leading zeroes. Decide how to handle blank prices, duplicate SKUs and rows that disagree with the application’s current data. Review those rules with whoever maintains the catalog before the import.

2. Add the importer in Filament

In Filament 5, generate a product importer with php artisan make:filament-importer Product. Define the allowed columns and attach the importer to an ImportAction on the products table. Users can map CSV headers during upload, so a header such as unit_price_npr can map to your app’s price field.

Require a SKU and product name, validate the price as a nonnegative amount, and check that your database column can store the required precision. Keep the money unit consistent. For example, convert rupees to paisa explicitly if the application stores amounts in minor units.

3. Decide what happens on a second import

Filament creates a new record for each row by default. If staff will upload revised files, use the importer’s resolveRecord() method to look up an existing product by SKU. Enforce that key with a database constraint. For a multi-company app, scope the lookup and uniqueness to the company. Importing does not automatically check model policies, so enforce who can import and which records they can update.

4. Run a small test before the full import

  • Try a valid row, a missing SKU, an invalid price and a duplicate SKU in a test environment.

  • Run the file twice and compare the counts and changed fields with the intended behavior.

  • Check that the import queue processes jobs and that the operator can review and download failed rows.

  • Reconcile a few imported records against the source sheet before switching staff to the application.

Filament uses Laravel job batches and database notifications for this workflow. Check the required migrations and worker setup in the Filament import documentation.

If you’re replacing spreadsheets with an internal tool, write down who enters records, who reviews changes and what reports they need. You can see how those questions fit into my Laravel and Filament development service and the planning notes for the manpower accounting application.

Frequently asked questions

Why should I keep product SKUs as text in the spreadsheet?

Keeping SKUs as text helps preserve identifiers with leading zeroes and provides a stable key for matching records.

How can a second import update existing products?

Use the importer's resolveRecord() method to find products by SKU, and enforce SKU uniqueness with a database constraint.

How should prices be handled during import?

Validate prices as nonnegative amounts and convert them explicitly if the app stores money in minor units, such as paisa.

How can staff review rows that failed to import?

Filament allows operators to review and download failed rows. Test this workflow along with the queue before the full import.

Does importing automatically enforce model policies?

No. You must control who can import and which records they can update.

More from the notebook

Web development in Nepal

Plan a website for your audience in Nepal, from mobile design and Nepali content to technology, payments, and ongoing maintenance.

↗

Is PHP dead?

PHP is still a practical choice for websites, applications, and APIs. Here’s where it fits, where alternatives may help, and how to evaluate an existing PHP project.

↗
Have something in mind?

Let’s build something
that works for you.

Tell me about it
work@damodar.dev