Title: Pulling data from Excel file
Last modified: August 19, 2016

---

# Pulling data from Excel file

 *  [ruge](https://wordpress.org/support/users/ruge/)
 * (@ruge)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/)
 * Hi folks!
 * I am currently working on a phone company website. My client has requested a 
   series of pages to tabulate the price rates. However, he would like users to 
   be able to sort data by Country (click A,B,C etc) and then data will be displayed
   for those countries.
 * My first thought was to create 26 pages, however I believe there should be an
   easier way to do it. Is there any way I can create a page on WordPress that could
   pull data from an Excel file (and display data based on the letter selected?)
 * I know this sounds like a long shot, but I am aiming for this type of effect:
   [http://qlinkq.com.au/lankarates.php](http://qlinkq.com.au/lankarates.php)
 * Thank you in advance 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257649)
 * Typically you load the data from the spreadsheet in a MySQL database table and
   run SQL queries using PHP on each request to grab the relevant info from the 
   database. That is how the example page you linked to is doing it. You can import
   the data from the Excel sheet into the database table by exporting from Excel
   as a CSV file.
 * If there aren’t hundreds of entries it can also be done by displaying the full
   results for all the countries on a single page, and then use a Javascript accordion(
   hiding) technique to hide everything except for that which the user is trying
   to see. The javascript opens and hides sections depending on what the user clicks
   on.
 *  Thread Starter [ruge](https://wordpress.org/support/users/ruge/)
 * (@ruge)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257684)
 * Interesting. Im pretty much a designer, not a developer, so do you know any resources
   that I could look into? Would be greatly appreciated!
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257686)
 * Hi – Not sure where to direct you. You as the designer would create the HTML 
   table to display the stored contents, which would be retrieved by PHP code that
   then populated the table. It requires PHP and MySQL programming skills. Best 
   bet is Google for tutorials on database programming.
 * For the javascript accordion technique, Google for jQuery accordion.
 *  [boyplunder](https://wordpress.org/support/users/boyplunder/)
 * (@boyplunder)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257702)
 * Try this if it isn’t to be dynamic.
    Save the excel sheet to a web page. Open
   it in a web editor or TextEdit, copy the table you get, and paste it into an 
   html new post. I use this method on a football blog I have.
 * Always best to style it up in the web editor, not the post.
 *  Thread Starter [ruge](https://wordpress.org/support/users/ruge/)
 * (@ruge)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257863)
 * Hmm, well, it has to be somewhat dynamic.
 * Here’s my connundrum, I could easily copy a table and paste it into wordpress
   and it looks fine. However, lets say the letter B…. It has 330 entries. If i 
   tried to copy that into WordPress my PC hangs for quite somet ime…..
 * Ideally I wanted to be able to set up a script that would read a CSV file and
   display the table in the post the same way copy and pasting it would….
 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257874)
 * You do not want to paste all of that into a WP post. You are likely to have issues
   with the editor reformatting your code in ways you don’t want.
 * If the data in the tables is not updating often, a half way point between doing
   it in SQL and pasting it into WP posts could be:
 * Save 26 CSV files, one for each letter.
    Create one WordPress PAGE, not 26 posts.
   Create a custom page template that is used with that one WordPress page. This
   would be custom PHP that read the CSV file for the letter being processed and
   generated the table dynamically using the data in the CSV file as the table contents.
 * When someone clicked on the letter N, the URL would include ?letter=N at the 
   end of the URL. The PHP script would read that and select the CSV file for the
   letter N and populate the table with its contents.
 * Whenever the entries for a CSV file letter change you upload a revised version
   of that CSV file to the server and the changes are reflected on the site.
 * If the data can change once a day or once a week, this is not a good approach
   as its too much work. If it changes every month or a few times a year it becomes
   workable. The advantage of this approach is you don’t have to deal with SQL and
   custom tables. The PHP script to generate the table from the CSV file is not 
   very complicated, and as a designer you would apply the same styling to the table
   that you do in a straight HTML design. The PHP would generate the necessary class
   names that you attach styling to.
 * The Codes page for custom page templates is here
    [http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates](http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates)
   A tutorial from Google: [http://www.expand2web.com/blog/custom-page-template-wordpress/](http://www.expand2web.com/blog/custom-page-template-wordpress/)
 * The WP page would have no page content. It adds the Rates option to the site 
   Nav and serves as a shell to let the PHP in the custom template do its work.
 *  [JamesBB](https://wordpress.org/support/users/jamesbb/)
 * (@jamesbb)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257997)
 * This plugin can import Excel tables and data can also be sorted out.
    [http://wordpress.org/extend/plugins/wp-table-reloaded/](http://wordpress.org/extend/plugins/wp-table-reloaded/)
   Hope this helps.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Pulling data from Excel file’ is closed to new replies.

## Tags

 * [Excel](https://wordpress.org/support/topic-tag/excel/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [table](https://wordpress.org/support/topic-tag/table/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 4 participants
 * Last reply from: [JamesBB](https://wordpress.org/support/users/jamesbb/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/pulling-data-from-excel-file/#post-1257997)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
