Can Excel interpret the URLs in my CSV as hyperlinks?

ExcelCsvHyperlink

Excel Problem Overview


Can Excel interpret the URLs in my CSV as hyperlinks? If so, how?

Excel Solutions


Solution 1 - Excel

You can actually do this and have Excel show a clickable link. Use this format in the CSV file:

=HYPERLINK("URL")

So the CSV would look like:

1,23.4,=HYPERLINK("http://www.google.com")

However, I'm trying to get some links with commas in them to work properly and it doesn't look like there's a way to escape them and still have Excel make the link clickable.

Does anyone know how?

Solution 2 - Excel

With embedding the hyperlink function you need to watch the quotes. Below is an example of a CSV file created that lists an error and a link to view the documentation on the method that failed. (Bit esoteric but that's what I am working on)

"Details","Failing Method (click to view)"
"Method failed","=HYPERLINK(""http://some_url_with_documentation"",""Method_name"")"

Solution 3 - Excel

I read all of these answers and some others but it still took a while to work it out in Excel 2014.

The result in the csv should look like this

"=HYPERLINK(""http://www.Google.com"",""Google"")"

Note: If you are trying to set this from MSSQL server then

'"=HYPERLINK(""http://www.' + baseurl + '.com"",""' + baseurl + '"")"' AS url

Solution 4 - Excel

you can URL Encode your commas inside the URL so the URL is not split across multiple cells.

Just replace commas with %2c

http://www.xyz.com/file,comma.pdf

becomes

=hyperlink("http://www.xyz.com/file%2ccomma.pdf";)

Solution 5 - Excel

Yes, but it's not possible to link them automatically. CSV files are just text files - whatever opens and reads them is responsible for allowing you to click the link.


As to how Excel seems to handle CSV files - everything between commas is interpreted as if it already had been typed into the cell. Therefore, the CSV file containing ="http://google.com",=A1 will display as http://google.com,http://google.com in Excel. It's important to note, however, that hyperlinks in Excel are metadata, and not the result of anything in the actual cell (ie, a hyperlinked cell to Google still contains http://google.com not <a>http://google.com</a> or anything of that sort.)

Since that's the case, and all metadata is lost when converting to a CSV, it's impossible to tell Excel you wish for something to be hyperlinked merely by changing the cell value. Normally, Excel interprets your input when you hit 'Enter' and links URLs then, but since CSV data is not being entered, but rather already exists, this does not happen.

Your best bet is to write some sort of addon or macro to run when you open up a CSV which parses every cell and hyperlinks them if they match a URL format.

Solution 6 - Excel

"=HYPERLINK("" " + "http://www.mywebsite.com"+ """)" use this format before writing to CSV.

Solution 7 - Excel

As described above, "=HYPERLINK(""http://www.google.com"", ""Google"")" is what worked for me.

However, In Excel Version 2204 Click to Run, I couldn't have leading white space.

For example;

FirstName, "=HYPERLINK(""http://www.google.com"", ""Google"")" fails FirstName,"=HYPERLINK(""http://www.google.com"", ""Google"")" success

Solution 8 - Excel

Use this format:

=HYPERLINK(""<URL>"";""<LABEL>"")

e.g.:

=HYPERLINK(""http://stackoverflow.com"";""I love stackoverflow!"")

P.S. The same format works in LibreOffice Calc as well.

Solution 9 - Excel

The issue here for me was that because a .CSV by it's nature is Comma separated, any commas in the text file are interpreted as separators. It worked for me by using tab characters as separators, saving it as a .TXT file so that when opened in EXCEL you choose the TAB character rather than ','.

In the text file …

## ensure that the file is TAB separated Item 1 A file Name data.txt Item 2 Col 2 =HYPERLINK("http:\www.ilexuk.com","ILEX")

"ILEX" then is shown in the cell and "http:\www.ilexuk.com" is the hyperlink for the cell.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLiorView Question on Stackoverflow
Solution 1 - ExcelDaveView Answer on Stackoverflow
Solution 2 - ExcelP HemansView Answer on Stackoverflow
Solution 3 - ExcelarbitView Answer on Stackoverflow
Solution 4 - ExcelJimView Answer on Stackoverflow
Solution 5 - Exceldlras2View Answer on Stackoverflow
Solution 6 - ExcelAmitView Answer on Stackoverflow
Solution 7 - ExcelEricView Answer on Stackoverflow
Solution 8 - Exceluı6ʎɹnɯ ꞁəıuɐpView Answer on Stackoverflow
Solution 9 - ExcelDick EdwardsView Answer on Stackoverflow