PHP code example of justiversen / sheetmapper

1. Go to this page and download the library: Download justiversen/sheetmapper 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/ */

    

justiversen / sheetmapper example snippets


    $data = (new \JustIversen\SheetMapper\SheetMapper)
        ->source($inputArray)
        ->modifyHeaders([
            'name in file' => 'component_name',
            'stkpris' => 'component_price',
            'beskrivelse' => 'component_description',
        ])
        ->toLower()
        ->numberToFloat(['measurement_amount'])
        ->get();

    $data = (new \JustIversen\SheetMapper\SheetMapper)
        ->source(request()->file)
        ->modifyHeaders([
            'name in file' => 'component_name',
            'stkpris' => 'component_price',
            'beskrivelse' => 'component_description',
        ])
        ->concat(['component_name', 'component_price'], '-', 'concatted_column')
        ->checkForNull()
        ->trim()
        ->get();