When I try to encode a HTML anchor link in CSV file cell it becomes corrupted and not readable by Excel.
Is there some sort of non-HTML solution or format to encode a hyperlink in CSV file cell?
When I try to encode a HTML anchor link in CSV file cell it becomes corrupted and not readable by Excel.
Is there some sort of non-HTML solution or format to encode a hyperlink in CSV file cell?
A CSV file is simply text - it's up to the loading program how it chooses to interpret the text.
If Excel is complaining when you feed it "<a href=\"blah\">Link</a>", "another cell"
then try just having the raw URL and you might find Excel will automagically turn it into a link.
But in general Excel doesn't process HTML, so expecting it render HTML from a CSV file is asking too much.
For when automagicalism doesn't work, and you're definitely using Excel, use this as the field content.
=HYPERLINK("http://stackoverflow.com")
What worked for me in Excel 2003 - output to your CSV the statement:
CELLVALUE="=HYPERLINK("+QM+URLCONTENTS+QM+";"+QM+"URLDISPLAYNAME"+QM+")"
;
use in the hyperlink. I've found the comma not to work for me in Excel 2003."=HYPERLINK("URLCONTENTS";"URLDISPLAYNAME")"
where:
CELLVALUE
is the output written to the CSVQM
is the ASCII value of ["]
-> (ASCII 34)URLCONTENTS
is the full URL to the page you want to link to.
-URLDISPLAYNAME
is the text you see in the Excel cell.
File/Properties > Tab Summary > Field Hyperlink Base.
Use as fieldvalue something like http://www.SITENAME.com/SUB_LOCATION/../SUB_LOCATION
that sets your starting point so you can click it in Excel. Of course, you don't have to use SUB_LOCATIONs if the sitename itself already will resolve successfully for your relative path.
What I couldn't find is how to make the links automatically underlined in Excel. From other tips found in this article:
Format manually all linkcells as underlined and darkblue (for example) and then the standard functionality appears with already visited links turning into another color.
This worked for me:
=HYPERLINK
function, the first parameter is the web link, the second is the cell value."
quotes around the entire function. ""
Here's a four-column comma-delimited example.csv
:
5,6,"=HYPERLINK(""http://www.yahoo.com"";""See Yahoo"")",8
When a spreadsheet program (LibreOffice, etc.) opens this .csv, it creates an active link for you.