You will need 2 pear packs
- PHP-ExcelReader package
- Spreadsheet_Excel_Writer Package
What you need to do is first read the excel file to use the PHP-ExcelReader package. It reads the binary format of XLS files directly and can return values ββand formats from any cell. http://code.google.com/p/php-excel-reader/
read excel file
$data = new Spreadsheet_Excel_Reader("test.xls");
show file data
$data->dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel')
After you have saved the data in a variable, save the data in another file, this time you will use the Spreadsheet_Excel_Writer package https://github.com/pear/Spreadsheet_Excel_Writer
<?php require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer('test.xls'); $worksheet =& $workbook->addWorksheet('My first worksheet'); if (PEAR::isError($worksheet)) { die($worksheet->getMessage()); } $workbook->close(); ?>
Gerard banasig
source share