Help in using Spreadsheet_Excel_Writer!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shishi
Forum Newbie
Posts: 14
Joined: Wed Apr 22, 2009 12:05 am

Help in using Spreadsheet_Excel_Writer!

Post by shishi »

Is it possible to modify a specific sheet of an existing excel file using Spreadsheet_Excel_Writer?
Please provide sample code.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Help in using Spreadsheet_Excel_Writer!

Post by Benjamin »

shishi wrote:Please provide sample code.
Not going to happen. Post your code first.
shishi
Forum Newbie
Posts: 14
Joined: Wed Apr 22, 2009 12:05 am

Re: Help in using Spreadsheet_Excel_Writer!

Post by shishi »

ok here's what i have so far:

Code: Select all

<?
 
require_once 'Excel/reader.php';
 
 
// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader();
 
 
$data->setOutputEncoding('CP1251');
 
// Read this file
$data->read('Book1.xls');
 
 
// Show data of all the sheets from Book1.xls
for ($h = 0; $h < count($data->sheets); $h++) {
    print "<br><table border='1'>";
    for ($i = 1; $i <= $data->sheets[$h]['numRows']; $i++) {
        print "<tr>";
        for ($j = 1; $j <= $data->sheets[$h]['numCols']; $j++) {
            print "<td>".$data->sheets[$h]['cells'][$i][$j]."</td>";
        }
        print "</tr>";
 
    }
    print "</table>";
 
}
 
// include package for writing
include 'Spreadsheet/Excel/Writer.php';
 
 
// DON'T KNOW HOW TO DO IT NEXT
// HERE I NEED TO WRITE SOME DATA INTO A SPECIFIC SHEET IN Book1.xls THEN SAVE IT
 
 
?>
Last edited by Benjamin on Fri May 01, 2009 4:53 am, edited 1 time in total.
Reason: Added code tags.
Post Reply