[Solved] PEARL Spreadsheet_Excel_Writer Question

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

[Solved] PEARL Spreadsheet_Excel_Writer Question

Post by DarkRanger »

Does anyone know how I can save the file to disk?

I need to attach the created excel sheet to an email and mail it somewhere.

According to the documentation the following should work:

Code: Select all

<?php
require_once 'Spreadsheet/Excel/Writer.php';

// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer('test.xls');

// Creating a worksheet
$worksheet =& $workbook->addWorksheet('My first worksheet');

// Sets the Temp Save directory
$workbook->setTempDir('var/www');

// The actual data
$worksheet->write(0, 0, 'Name');
$worksheet->write(0, 1, 'Age');
$worksheet->write(1, 0, 'John Smith');
$worksheet->write(1, 1, 30);
$worksheet->write(2, 0, 'Johann Schmidt');
$worksheet->write(2, 1, 31);
$worksheet->write(3, 0, 'Juan Herrera');
$worksheet->write(3, 1, 32);

// Let's send the file
$workbook->close();
?>
But when I browse to that directory, no file exists. Does the server remove the file when the script is completed or how does it work?

Any idea where it might be saving the file?
Last edited by DarkRanger on 19 Jan 2011, 08:52, edited 1 time in total.
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: PEARL Spreadsheet_Excel_Writer Question

Post by DarkRanger »

Nevermind. I was looking in the wrong directory. OMG I should sleep more... :lol:
Image
Post Reply