PHP code example of knackline / excel-to-x

1. Go to this page and download the library: Download knackline/excel-to-x library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

knackline / excel-to-x example snippets


use Knackline\ExcelTo\ExcelTo;

$jsonData = ExcelTo::json('path/to/your/excel_file.xlsx');

use Knackline\ExcelTo\ExcelTo;

$collection = ExcelTo::collection('path/to/your/excel_file.xlsx');

use Knackline\ExcelTo\ExcelTo;

$arrayData = ExcelTo::array('path/to/your/excel_file.xlsx');

use Knackline\ExcelTo\ExcelTo;

// Convert Excel to JSON
$jsonData = ExcelTo::json('path/to/your/excel_file.xlsx');

// Convert Excel to Collection
$collection = ExcelTo::collection('path/to/your/excel_file.xlsx');

// Convert Excel to Array
$arrayData = ExcelTo::array('path/to/your/excel_file.xlsx');