Jump to content


Photo

Importing to Excel


  • Please log in to reply
2 replies to this topic

#1 ibanez270dx

ibanez270dx
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 10 August 2006 - 03:45 PM

Hi,
I am seriously at my wit's end about this... I need to be able to click a link, which opens up a dynamically created Excel page with X number of rows and 9 columns. I am currently using a script called "excelwriter", but I can't seem to get it to work properly - that is, write all the rows into the excel file (I can only write one dynamically, which is a little useless...). So, my question would be: How would I be able to accomplish this if I rewrote the whole script? I'm talking from scratch... Also, is it possible to import my data as an HTML table to Excel? I think that would be easiest.

Thanks in advance,
- Jeff

#2 kalivos

kalivos
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationCalifornia

Posted 10 August 2006 - 05:01 PM

You might be interested into learning how CSV works  ;)

http://forums.dreami...wtopic10131.htm
Make a donation to phpfreaks. They need your help![br][br]

#3 ibanez270dx

ibanez270dx
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 10 August 2006 - 05:49 PM

sweet - it pretty much works the way I want. How would I be able to format cells though? For example, have the cell labels in bold or something? Here is my code:

$cr = "\n";
$title = "TITLE" . ',' . $monthname . ',' . $year . $cr;
$catanames = 
"Type" . ',' . "Date" . ',' . "Downtime" . ',' . "Hours Down" . ',' . 
"ATA" . ',' . "Discrepancy" . ',' . "Resolution" . ',' . "Logged" . ',' . 
"Logged By" . $cr;
 	 
$data .= 
$dwntime_type . ',' . $dwntime_date . ',' . $dwntime_times . ',' . 
$dwntime_hrs . ',' . $dwntime_ata . ',' . $dwntime_reason . ',' . 
$dwntime_solution . ',' . $dwntime_log . ',' . $dwntime_log_by . $cr;
	}

$fp = fopen($filename2,"a");
	if($fp)
	{
	 fwrite($fp, $title);
	 fwrite($fp, $catanames);
	 fwrite($fp, $data);
	 fclose($fp);
	 echo "File saved successfully. <a href=$filename.csv>click here to access $filename2</a>";
	} else {
	 echo "Error saving file!";
	}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users