2

I have an Excel sheet with several sheets and containing quite a few tables of information which are really intended to be published on a common wiki at my company. Previously, we used to use MediaWiki, and I had found a very good export tool that took a selection in Excel and generated a huge chunk of very readabble MediaWiki table markup. Several such tables were usually put on the same Wiki page.

Unfortunately for this approach, company changes ensued, and now the same information needs to go either into essentially bare-HTML pages or a Twiki system. Neither of which supports the dear old Mediawiki syntax.

So the question is: is there some way to export clean HTML or Twiki table syntax from an Excel table selection?

If you select "save as..." "html" "selection only" in Excel itself, you get one complete web page per table. Sure, the core table bit can be extracted from that. However, the code is pretty horrific, full of MS style things to make it look EXACTLY like in Excel, which is not in general what you want. You want the wiki engine and browser to deal with formatting that works OK on the screen someone is using.

(for some reason you cannot get an HTML code block to show up in SuperUser posts...)

4
  • 1
    FYI: any code/preformatted text blocks should be preceeded by 4 spaces on every line. Check out superuser.com/editing-help for more tips.
    – DMA57361
    Commented Aug 16, 2010 at 9:20
  • I tried four spaces... but when what comes up is pure HTML code, it looks like the system just tried to render it rather than display it verbatim. Commented Aug 17, 2010 at 11:28
  • @jakobengblom2 Inspired by your mention on MediaWiki, here is an interesting solution. Copy the desire range in Excel, then paste it to ckeditor.com/demo. Click "Source". (Quite clean) HTML codes are right there. (You can use other WYSIWYG editor with view source function). If it is a good solution, let me know and I will put it as answer.
    – wilson
    Commented Oct 30, 2012 at 3:33
  • @wilson that was an interesting approach. It seems that the act of pasting excel cells into the editor stripped pretty much all formatting, which is better than having all formatting along. But my goal was really to maintain specific parts of formatting - in particular, text color and background cell shading. Still, an interesting solution that could well work for similar use cases. Commented Nov 11, 2012 at 7:01

1 Answer 1

2

I believe Excel Macro would help in this case.

But, I personally just do it by simple formula.

Example:

For example, the range B10:D20 is the range you want. Then just find a empty column (say column X:X), and write this formula in X10, and copy it down to X11:X20:

= "<tr><td>" & B10 & "</td><td>" & C10 & "</td><td>" & D10 & "</td></tr>"

Then, copy X10:X20 to notepad, and wrap it with <table> & </table>.

(Finally, Delete column X)

Advantage:

  • Simple & straight forward.
  • Comparing with using macro, you can specify the syntax each time.
1
  • Good simple idea. I would like a bit more smarts in the solution, however, to handle things like multiple-column and multiple-row spanning cells as well as cell alignment. Commented Aug 16, 2010 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .