?
Solved

Using PHP to create MS Excel Sheets

Posted on 2004-11-18
4
Medium Priority
?
241 Views
Last Modified: 2012-08-13
Hi everyone,
Just needed some help with php. Let me get straight to the point, I need to figure out how to create excel sheets in php so that users who come to my site enter in some info, I thenmake the sheet for them and create a link for them to download the excel sheet. I will also probably need to implement sessions to delete the old excel sheets. Anyways I have no idea how to create excel sheets in php and was wondering if anybody could help me figure out how to do so.

I need to be able to:
1)  enter in specific data into certain fields
2)  format the cells (ie. show as percent instead of decimal)
3)  add styles to specific cells (ie. bg colour, fonts, alignment, etc.)

This site is generally going to be used to help University students create personal Grade calculators where they enter in the number of assignments/tests/reports they have, what mark they recieved in each (blank for those not yet recieved/done), what mark they would like to get. Based on this info the sheet will display what marks they need to get to recieve their desired final and what mark they would get if they get perfect in the unmarked sections. Also it will tell them what their current mark is.

I have already created a template sheet (with formulas) which I am using for my own marks and hope to use that as a guide for my site.
0
Comment
Question by:popnfresh86
4 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 750 total points
ID: 12622741
See http://pear.php.net/package/Spreadsheet_Excel_Writer
I use it to create such xls-files. What you can't do is edit an exisiting xls-file, but you can create formulars, text, formating, ..

If you use a windows-server you might use COM to access excel and modify your xls-files.
0
 
LVL 1

Expert Comment

by:compustarsg
ID: 12622948
one more way is you can create csv (comma seperated)  files using php, which you can open in ms excel. but you cant do formating, coluring etc., may be some way but i dont know.
0
 
LVL 1

Expert Comment

by:Codeit1978
ID: 12625295
I found this site where it creates the excel file from a SQL database.
You may want the users to enter in the data save it to the SQL database and then generate the spead sheet and prompt the user to download.

This url shows you how to create a excel spread sheet from a SQL database.

http://www.stargeek.com/php_scripts.php?script=2&PHPSESSID=abddb1bbe251144cf84109b93ea06ed1
0
 

Author Comment

by:popnfresh86
ID: 12635404
Thanks for the suggestions. hernst42 gets the points cuz it was more of what i was looking for. Thanks again.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question