Using PHP to create MS Excel Sheets

Posted on 2004-11-18
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.
Question by:popnfresh86
    LVL 48

    Accepted Solution

    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.
    LVL 1

    Expert Comment

    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.
    LVL 1

    Expert Comment

    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.

    Author Comment

    Thanks for the suggestions. hernst42 gets the points cuz it was more of what i was looking for. Thanks again.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now