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'm looking for a way to preserve italicized text when exporting from XLSX to CSV. I know CSV doesn't support styled text, but I'm wondering if anyone knows of a workaround. For instance, does Excel have a way of converting selected cells to HTML? (Wrapping the italicized text in em tags would solve my problem.)

UPDATE: Thought I should clarify, my intention is to import the CSV into a MySQL database through a PHP script, and output as HTML.

Another UPDATE: I'm using Excel 2008 for Mac.

share|improve this question
    
It sounds easier to just open the file in OpenOffice.org Calc and do the HTML conversion in there. –  Ignacio Vazquez-Abrams Oct 19 '10 at 21:03
    
I'm looking at Calc right now, but I'm not seeing any HTML conversion options... –  handsofaten Oct 19 '10 at 22:04
    
One of the export formats here (3.1.1) is XHTML. –  Ignacio Vazquez-Abrams Oct 19 '10 at 22:09
    
I see what you mean. But parsing this kind of XHTML is going to make things a lot more complex (maybe not quite as bad as the Excel 2004 XML...) –  handsofaten Oct 20 '10 at 3:32
    
You could process it (or the Excel output mind you, or even the raw MSOXML) in XSLT to strip out the unneeded parts. –  Ignacio Vazquez-Abrams Oct 20 '10 at 3:36

1 Answer 1

up vote 1 down vote accepted

So this is basically what I was looking for:

http://www.xlmacros.com/content/how-search-italic-text-range-using-excel-vba

It's a VBA script that will wrap <em> tags (or actually <i> tags) around italicized text in cells. That way, I can export as CSV, and then just dump that text straight into a database table, with no complex parsing, but preserving italics. It requires a Windows version of Excel, or (presumably) the new 2010 Mac version, which is supposed to support macros.

Or maybe some AppleScript genius could figure it out. I'll probably just try to get on Windows Excel for a bit and see if this script works.

share|improve this answer

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.