PHPackages                             elliotghorbani/laravel-spreadsheet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. elliotghorbani/laravel-spreadsheet

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

elliotghorbani/laravel-spreadsheet
==================================

Export from and import to database

0.1.1-alpha(3y ago)01MITPHPPHP ^8.0

Since Mar 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/elliot-ghorbani/laravel-spreadsheet)[ Packagist](https://packagist.org/packages/elliotghorbani/laravel-spreadsheet)[ RSS](/packages/elliotghorbani-laravel-spreadsheet/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (6)Versions (5)Used By (0)

Laravel Spreadsheet
===================

[](#laravel-spreadsheet)

[![Total Downloads](https://camo.githubusercontent.com/93bfaf8959e0ae82e2b8ea891500616dabfeba352051c5035b4e6fca4fd2a6f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6c696f7467686f7262616e692f6c61726176656c2d7370726561647368656574)](https://packagist.org/packages/elliotghorbani/laravel-spreadsheet)[![Latest Stable Version](https://camo.githubusercontent.com/543ae2dac34e0b01981f0381c2dc21c93ec8e886659e47d35b0e85c80378af50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6c696f7467686f7262616e692f6c61726176656c2d7370726561647368656574)](https://packagist.org/packages/elliotghorbani/laravel-spreadsheet)[![License](https://camo.githubusercontent.com/a861316831d43d3a5d68b1cb922f155e15b6d05b32bcb727d62f7bfaed91d36a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656c6c696f7467686f7262616e692f6c61726176656c2d7370726561647368656574)](https://packagist.org/packages/elliotghorbani/laravel-spreadsheet)

About this package
------------------

[](#about-this-package)

This package allows you to export from your database as csv dynamically.

NOTE: Import feature is not added yet.

Installation
------------

[](#installation)

composer require elliotghorbani/laravel-spreadsheet

php artisan vendor:publish --provider="ElliotGhorbani\\LaravelSpreadsheet\\SpreadsheetServiceProvider"

In the generated config file you can override the table name under "spreadsheet\_table" key.

php artisan migrate

Usage
-----

[](#usage)

1. Make a GET request to "/spreadsheet/tables" It returns all tables of your database.
2. Make a POST request to "/spreadsheet/columns" with a parameter name "table\_name".

```
{
    "table_name": "users"
}
```

It returns all columns of the specified table. So than you can select desired columns and their position to be included in the spreadsheet. Please read NOTE 6.

3. Make a POST request to "/spreadsheet/filter-columns" with a parameter name "table\_name".

```
{
    "table_name": "users"
}
```

It returns all columns of the specified table that can be filtered with their datatype so that you can generate a form. Please read NOTE 7.

4. Make a POST request to "/spreadsheet" with below parameters.

```
{
    "table_name": "users",
    "export_data":
        {
            "columns": {"2": "id", "1": "email", "3": "username"},
            "filters": [
                {"column": "id", "operator": "
