Converting LibreOffice Calc URLs to text

Christian Mayne picture Christian Mayne · Apr 17, 2012 · Viewed 10.9k times · Source

I have a LibreOffice 3 spreadsheet (on Ubuntu 11.04) with a column of hundreds of hyperlinks which simply display as 'Link'.

I need to convert these to just plain text, or at worse hyperlinks which display the hyperlink rather than the text 'Link'. Is there a function which will do this, or perhaps a method that will do it across the entire spreadsheet?

Answer

A5C1D2H2I1M1N2O1R2T1 picture A5C1D2H2I1M1N2O1R2T1 · Apr 23, 2012

You can use a macro.

The only one I've tested is this one.

If you haven't had experience with macros, here are the steps involved:

  1. Copy the macro provided at that link.
  2. Press ALT + F11 to open your macros organizer.
  3. Under "My Macros" select "Module 1" and click on "Edit"
  4. Paste the macro code that you copied.
  5. Save and close your macro

Now, you have access to a macro titled "CELL_URL" which you can use as follows:

Assuming that your links start in "CELL A1" on "SHEET 1", I recommend you go to a new sheet, and in the first cell, enter: =CELL_URL("SHEET 1",ROW(),COLUMN()). Then, you can drag that formula according to the dimensions of your data.

Or, another example, assuming that you have a single column of 20 links, starting from "CELL B5" on "SHEET 1", and that you want the URL to be in the column next to it (thus, starting from "CELL C5"), in "CELL C5", enter the formula as follows: =CELL_URL("SHEET 1", ROW(), COLUMN()-1). Note the -1. That tells the function to extract the URL from the cell from one column less than the current position.Then, drag the formula from "CELL C5" to "CELL C24", where your links end.


Update:

The URL doesn't seem to be resolving. Fortunately, there's the WayBack Machine: http://web.archive.org/web/20120713222701/http://www.oooforum.org/forum/viewtopic.phtml?t=32909

I've also posted the macro as a Gist: https://gist.github.com/mrdwab/14c9e81dfbc867351bd3

As can be noted in the comments, you may need to change "SHEET 1" to "Sheet1" when using the CELL_URL() function.