PHP code example of labelworx / excel-converter
1. Go to this page and download the library: Download labelworx/excel-converter 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/ */
labelworx / excel-converter example snippets
use LabelWorx\ExcelConverter\ExcelConverter;
$excel = new ExcelConverter();
// Simple Conversions
$excel->source('path/to/input.xls')->toCSV('path/to/output.csv');
$excel->source('path/to/input.xlsx')->toTSV('path/to/output.tsv');
$excel->source('path/to/input.csv')->toTSV('path/to/output.tsv');
$excel->source('path/to/input.tsv')->toCSV('path/to/output.csv');
// Converts Pipe delimited file to Semi-Colon delimited file by passing delimiters
$excel->source('path/to/input.txt', '|')->to('path/to/output.txt', ';');
// For Excel source files you can specify a worksheet by name or number
$excel->source('path/to/input.xls')->worksheet('Sheet 2')->toCSV('path/to/output.csv');
$excel->source('path/to/input.xlsx')->worksheet(2)->toTSV('path/to/output.tsv');
// For Excel source files you can also specify an export date format
$excel->source('path/to/input.xls')->exportDateFormat('d/m/Y')->toCSV('path/to/output.csv');
$excel->source('path/to/input.xlsx')->exportDateFormat('d/m/Y')->toTSV('path/to/output.tsv');
use LabelWorx\ExcelConverter\Facades\ExcelConverter;
ExcelConverter::source('path/to/input.xls')->toCSV('path/to/output.csv');