Converting LibreOffice Calc URLs to text


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?

Best Solution

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.


The URL doesn't seem to be resolving. Fortunately, there's the WayBack Machine:

I've also posted the macro as a Gist:

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

Related Question