Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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...)

share|improve this question
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 Aug 16 '10 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. –  jakobengblom2 Aug 17 '10 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 Oct 30 '12 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. –  jakobengblom2 Nov 11 '12 at 7:01
add comment

1 Answer

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.
share|improve this answer
    
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. –  jakobengblom2 Aug 16 '10 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.