MySQL to Excel

Posted on 2012-09-21
Last Modified: 2012-09-26
I want to create an Excel file from a MySQL Table with PHP.

Which is the best PHPExcel template to use?  Is there another example I can follow?
Question by:rgranlund
    LVL 107

    Accepted Solution

    I would just write the table out in ".csv" format.  The CSV file type is almost universally associated with Excel.  You can write the file into the server file system and give the client a link to the URL of the CSV file.  A click will open it in Excel, or at least prompt the client to download the file.
    LVL 8

    Expert Comment

    If you really need Excel format (xls/xlsx), I recommend phpExcel. It can be downloaded from
    This library is pretty good, but it can be slow a bit if you work with a big bunch of data.
    LVL 7

    Author Comment

    @MrEne In my post I wrote "Which is the best PHPExcel template to use? "

    Which is the best template to start with that can create a simple file?
    LVL 7

    Author Closing Comment

    I found a great, simple example that explained it really well.  Thanks for pushing me in the correct direction.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    728 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

    16 Experts available now in Live!

    Get 1:1 Help Now