Deleting external links

Hey list,

we are dealing with a rather complex spreadsheet and looking at
Edit→Links, there are literally thousands of links in there that are
no longer used anywhere in the document. Opening the document (and
saving, and sometimes editing, and …) takes several minutes, and we
think this is due to the sheer massive number of links.

We found that links can be individually deleted (broken), but we
were wondering if there's a way to do so in bulk? Or better yet, how
can I automatically remove unused references in this list?

Thanks for any hints,

Hey list,

we are dealing with a rather complex spreadsheet and looking at
Edit→Links, there are literally thousands of links in there that are
no longer used anywhere in the document. Opening the document (and
saving, and sometimes editing, and …) takes several minutes, and we
think this is due to the sheer massive number of links.

We found that links can be individually deleted (broken), but we
were wondering if there's a way to do so in bulk? Or better yet, how
can I automatically remove unused references in this list?

Thanks for any hints,

There are 5 different types of spreadsheet links. Some appear in
menu:Edit>Links, database links can be organized in menu:Data>Define

DDE("soffice";"path_name","ref") and URL links
'file:///path/name.ods'#$Sheet.A1 are established by formula
expressions. Before you can delete them in the links dialog, you have to
remove all formula references.

[Tutorial] External Links In Calc:

also sprach Andreas Säger <villeroy@t-online.de> [2016-04-20 17:20 +0200]:

DDE("soffice";"path_name","ref") and URL links
'file:///path/name.ods'#$Sheet.A1 are established by formula
expressions. Before you can delete them in the links dialog, you
have to remove all formula references.

I don't want to remove all links. I want to remove those links that
are no longer in use.

Here's a simple example: let's assume $A$1 has the contents
"blue.ods", and I fill $B1:$B100 with a formula along the lines of

  # effectively copy 100 cells from blue.ods#Sheet 1 column B
  DDE("soffice"; $A$1; CONCATENATE("Sheet 1.$B$"; ROW()))

This will generate 100 links.

Now I change "blue.ods" to "red.ods" and recalculate. Now I have 200
links, but 100 of those are no longer in use.

Does this make sense?