PHP code example of awsome-kill / php-spreadsheet-helper

1. Go to this page and download the library: Download awsome-kill/php-spreadsheet-helper 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/ */

    

awsome-kill / php-spreadsheet-helper example snippets


return SHelper::make('write')
    ->addTitle('XX商品列表')
    ->addHeader([
        ['name',20,'商品名称'],
        ['num',15,'数量'],
        ['category',20,'分类'],
        ['price',15,'售价']
    ])
    ->setData($data)
    ->output('商品表','xlsx');

$list =  SHelper::make('read')
    ->addFile($file_path)
    ->setHeader([
        ['product_name','商品名称'],
        ['unit_name','单位'],
        ['category_name','商品分类'],
        ['price','价格'],
        ['cost_price','成本价'],
        ['bar_code','商品条码'],
        ['stock','库存']
    ])
    ->output();