PHP code example of iamapen / excel-friendly-data-set

1. Go to this page and download the library: Download iamapen/excel-friendly-data-set 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/ */

    

iamapen / excel-friendly-data-set example snippets


$ds = new Iamapen\ExcelFriendlyDataSet\Database\DataSet\CommentableCsvDataSet(",");
$ds->setIgnoreColumnCount(1);    // 1列目を無視

$ds = new Iamapen\ExcelFriendlyDataSet\Database\DataSet\ExcelCsvDataSet();

use Iamapen\ExcelFriendlyDataSet\Database\DataSet\CommentableCsvDataSet;
use Iamapen\ExcelFriendlyDataSet\Database\Operation\MySqlBulkInsert;

// DataSet
$ds = new CommentableCsvDataSet('PATH/TO/CSV');

// 実行
$operation = new MySqlBulkInsert();
$operation->execute($this->getConnection(), $ds);