Support » Fixing WordPress » Copy/paste Excel data to a page and retain formatting

  • Resolved BillHam


    I am developing (on localhost) a new site that has to include pages containing excerpts from Excel sheets. Not the whole Excel file or a whole sheet, just a portion of a sheet. I’m converting an old site created and maintained with MS FrontPage 2003 (OK, stop giggling at the back there) into a WordPress equivalent and under FP it was easy to copy/paste tables of data from an Excel sheet directly to an FP page and publish it. They always came out as they were formatted on the Excel sheet. The HTML is rubbish, but the job is done.

    Can’t do this in WordPress. The formatting is always off and frequently just missing as either WP or my Theme (Weaver Xtreme) strips it out. I know tables are deprecated these days but sometimes it’s the only way to present, er, tabular data such as what comes from Excel. I’m not talking fancy charts or anything – just groups of fomatted cells that comprise a single tabular report. For some reason it’s always the borders that get stripped out and column widths are knocked about a lot too.

    I’ve searched and searched for something that will allow/facilitate a copy/paste directly from Excel to a WP page and keep the original formatting. I found some plugins that stage the conversion and the output looks good (e.g. Docxpresso) but these all import whole files and don’t go anywhere near copy/paste. I don’t particularly want to have to go the trouble of extracting my little tables into a new .xlsx or .csv or .ods file, uploading them and displaying them with a shortode. Some will have to be regularly updated/refreshed (say weekly) so a simple and easily repeatable solution would be welcome.

    If this can be done in a very straightforward manner with a 15-year-old out-of-date site construction tool why is it so difficult with a modern one? Is this progress?

    Am I asking too much? I can’t be the first person in the world to want to do this and I’ve generally found that if I want to do something extra or non-standard in WordPress then somebody somewhere has thought of it already and developed a solution. It’s not leaping out at me with this problem though, but it does seem a pretty simple thing to want to do.

    Any advice? Is there a neat little plugin I haven’t spotted that does this?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Steven Stern (sterndata)


    Support Volunteer

    The plugin “tablepress” supports importing CSV files, so you could export your Excel sheet into CSV then import it into a Tablepress table.



    Thanks for the reply. I looked at Tablepress quite early on and rejected it pretty quickly. It’s one of those plugins that require the cells comprising the table I want to go onto my WP page to be saved as a separate file (and btw, CSVs don’t carry any formatting info) and that is one of the things I’m trying to avoid. Anyway, saving it as an xls file instead and importing that into Tablepress results in a very plain-jane (sorry, are we allowed to say that these days?) table with minimal formatting that it has thought up all by itself. In particular, borders are again removed and any bolding is also removed.

    Tablepress’s table manipulation page just does not give me the options to format the table the way I want it and I would not want to have to do that every time one of my tables was changed and needed to be replaced on the WP page. Maybe I’m not understanding Tablepress sufficiently. Call me old-fashioned but I want my tables to look like what I want, not what some plugin developer thinks might look good.

    I’m still looking for a quicker and more direct way of transferring selected cells from Excel to a WP page and keep the original formatting than by 1. extract, 2. save, 3. import (by whatever method). If I really have no option but to go that way I’d probably use Docxpresso. I live in hope though.

    Moderator bcworkz


    Heh, you funny guy 🙂

    You’re not going to think this is funny though, sorry. Essentially, yes, you’re asking too much. To put it bluntly, you’re (at least your data is) living in the past and technology has marched on. It keeps marching faster all the time. Best to catch up while you still can.

    At the very least, you’ll need to accept that some sort of interstitial data format is going to be part of the process. PCs have the capability of OLE which allows for easy copy/pasting of table segments into other PC apps. Unfortunately, your WP server is not a PC, or at least the server software does not support OLE. A common format usable by both will be needed.

    IMO, it’s a very poor data schema to maintain data in one, antiquated format, and to continually need to import it into a different format to be able to share it with others. Ideally, the source data should be part of the WP database. All input, edits, and output should be managed within WP itself. I realize that some spreadsheets are extremely complex and converting them to a WP plugin would be a major coding project. But if it’s anywhere near feasible, you should pursue it. Otherwise resign yourself to the need of an interstitial format.



    Hi bcworkz. Aha! Saracasm – I like it.

    Anyway, I appreciate the time you took to respond and I take on board the reasonings in your second paragraph. Looks like I shouldn’t be holding my breath, then.

    As for your third paragraph and accusations of living in the past, yes I have to hold up my hand on that. The underlying tables which are transferred from Excel (and in a couple of cases, Word) are maintained in legacy files so far removed from a website as can be imagined. There is quite a lot of VBA macro activity too. My task as site administrator is to transfer tables to my site so that a wider public can have access to them. Up to now, that’s been straightforward and dead easy. It’s for a target shooting sports organisation and shooting is a sport based on numbers (scores) and statistics (averages) and lists of competitors and their scores are commonplace. Holding that kind of data in Excel is the logical place. Some tables are historical archives and only get updated once a year to add one row with the latest information. Some tables are a little more dynamic and need to be changed weekly or so. Some (quite a lot) are converted to PDF files, uploaded and linked-to.

    I completely understand your arguments about moving on with the technology and the existing data schema. Unfortunatly it is well beyond my competence (or that of anyone I know of in the organisation) to maintain all the data in a WP database (it would have to be many databases). I used to be a professional programmer in a former life but VBA is my limit and do not intend to start learning PHP or SQL or whatever would be required at this stage. Rudimentary HTML is as far as I’m going with this and CSS is a closed book at least so far. WP was meant to be an easy option. Hiring a professional to set it all up is out of the question due to lack of funds and even if we had a few £K’s available the management committee are liable to say, if it ain’t broke don’t fix it. And I’m stuck with it.

    So, looks like I’m recreating an obsolete website as a not-quite-so-obsolete one. Better than doing nothing though.

    Moderator bcworkz


    Thanks for explaining further. I suspect we have more in common than either realises. A former pro programmer whose limit is VBA tells me tons. I totally get your situation, I also have a pile of data trapped in elaborate legacy spreadsheets. I applaud the desire to share the data. I’m sorry that WP is not as easy as expected. It is easy, but only in certain ways. As soon as you depart from the expected, there’s nothing easy about it. This seems to be the nature of the Internet these days.

    I suspected adapting the data to a SQL DB would be too involved, but without knowing the nature of the data or the programming resources you have available, it’s an option that should always be considered. Your main obstacle is the legacy .xls file format, which is relatively complex and difficult to code for. Combined with a limited need, no one’s willing to put in the effort to address it. Exporting to a format that is easier to code for and more widely used is going to be the best solution for your situation. Sure, not needing this extra step would be ideal, but it’s also not that big of an ask as an extra step.

    Maybe a good part of this extra step could be semi-automated. You could probably handle the VBA side. The PHP side could maybe be handled by someone with modest PHP skills if you can identify a plugin to do the heavy lifting.

    Best of luck to you in your quest.



    Thanks for the comments. I appreciate them and understand the implications.

    In my working career I wasn’t restricted to VBA. I worked with mainframes for a large insurance company. I started with the low-level language PLAN (never heard of it eh? Not surprised). I moved on to COBOL when we converted from ICL machines to IBM ones, and then as a systems programmer used SAS extensively for capacity management and computer performance reporting and the like. Oh, yes, there was a fair bit of BASIC programming on my BBC computer at home too. Only in the three years or so before I was invited to take early retirement in 2002 was I significantly exposed to PCs and got sucked into MS Office and Dreamweaver and went on a VBA course. I’ve used that latter expertise ever since to help organise and run competitions for the various target shooting organisations I’m associated with. I’m too old a dog to learn new languages properly now although I did poke about with PHP a few years ago so have an idea of what it’s about but as I said, my HTML knowledge is pretty sketchy and frequently involves looking up ‘how to’ sites.

    Sorry, you didn’t want to know any of that.

    I’m sure I’ll find a reasonably usable solution to the issues I’m facing.

    Closing this off now.

    Moderator bcworkz


    Maybe I didn’t “want” to know, but it’s always fun to hear of people’s background as they drift in and out of these forums. A touch of personal sharing and a human touch is nice to see. I doubt any old pro is limited to VBA, I suspected you might have been a COLBOL guy! It was being taught in school when I was there, but starting to die out as the PC revolution was soon to take over. My profession is not even directly related to computers, it’s something I picked up on the side. Everything I know about WP was largely picked up here in the forums doing research to help others.

    I rarely know the answers to many questions, but I have a better idea than most about where to look to find out. It’s often more about being a librarian than a programmer. Thanks for sharing.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Copy/paste Excel data to a page and retain formatting’ is closed to new replies.