[ACCEPTED]-How to modify existing excel file using PHP?-pear

Accepted answer
Score: 13

You will need 2 pear packages

  1. PHP-ExcelReader package
  2. Spreadsheet_Excel_Writer package

What you need 7 to do is read first the excel file use PHP-ExcelReader package It 6 reads the binary format of XLS files directly 5 and can return values and formats from any 4 cell. http://code.google.com/p/php-excel-reader/

read the excel file

$data = new Spreadsheet_Excel_Reader("test.xls");

show the data 3 of the file


Once you have stored the data 2 in a variable save the data in another file 1 this time you will use the The Spreadsheet_Excel_Writer package https://github.com/pear/Spreadsheet_Excel_Writer

require_once 'Spreadsheet/Excel/Writer.php';
$workbook = new Spreadsheet_Excel_Writer('test.xls');
$worksheet =& $workbook->addWorksheet('My first worksheet');
if (PEAR::isError($worksheet)) {

More Related questions