Results 1 to 5 of 5

Thread: Export HTML TABLE to EXCEL

  1. #1
    Join Date
    May 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Post Export HTML TABLE to EXCEL

    Hello, I've to export the records of an HTML table taken form joined MySQL tables to an excel file. How can I?

    Thanks for your help

    Ratto84

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    HTML tables normally copy and paste from a web page very well into an Excel spreadsheet (highlight and copy the table area of the web page and paste into Excel).

    Is that what you mean or do you have direct access to the server that houses the website and its MySQL / phpMyAdmin and want to run some sort of query in the backend to export and merge directly to Excel?
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    May 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Wink

    The first solution is great and new for me, thanks, but i meant the second way:
    I've to export in excel a table full by record taken from various tables. But I can't do it by PhpAdmin, because I need a button clickable by every users. I'm italian so, I hope my english to be understandable.

    Thanks

    Ratto84

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    The 2nd option wouldn't work publicly (you didn't say that it was for the front-end of a website in your 1st post and I thought you were possibly asking how to run queries).

    I not 100% sure but I think you'd need either something that outputs your web page table to a csv file or for you to prepare and provide the spreadsheet as a zipped download via a hyperlink.

    There are ASP scripts out there that you can incorporate into your web page that output the HTML as a csv file but I haven't tried any so I cannot make any recommendations (sorry)

    I think the main issues here are how often the data is updated and also your assumptions of what software your visitors have installed on their computers. If this is a public website (rather than an internal company system) you cannot guarantee that your visitors have Excel installed so providing a file in potentially 'wrong' format is confusing and frustrating. I also believe that security won't allow web based scripts to invoke an instance of Excel directly.

    Assuming that the table data does not change too frequently though, I guess that it will be easiest for your visitors if you prepare and provide a zipped spreadsheet file in .xls format (to ensure backwards compatibility with older versions of MS Office), and a link to download Open Office if they need it.

    Some of the other guys on the forum may be able to make other suggestions but I guess they'd need more info about your server setup and the type of data that you're wanting to offer for download as there may be tools already out there do a better job of providing/displaying/managing data that you want to make available.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. #5
    Join Date
    Feb 2008
    Posts
    81
    Thanks
    8
    Thanked 5 Times in 5 Posts

    Default

    If you want to do that directly through script, you must somehow be able to create a bridge between the data in PHP and in Excel.

    For that, you can use PHP libraries which allow conversion to Excel data, through XML support.
    Try this: http://code.google.com/p/php-excel/


    Also, you could do the same yourself by exploiting Excel's XML support. (Could get little complicated), like this: http://www.ibm.com/developerworks/op...cel/index.html

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •