ExternalLinkCollection

ExternalLinkCollection class

Represents external links collection in a workbook.

Properties

NameTypeDescription
CountNumberGets the number of elements actually contained in the collection.
Item (int)ExternalLinkGets the ExternalLink element at the specified index.

Methods

NameDescription
addAdds an external link.
clearRemoves all external links.

When removing external links, all formulas that reference to them will be removed too becau | | removeAt | Removes the specified external link from the workbook.

When removing the external link, all formulas that reference to | | iterator | Get an enumerator that iterates through this collection. |

ExternalLinkCollection.Count property

Gets the number of elements actually contained in the collection.

Type: Number

ExternalLinkCollection.Item (int) property

Gets the ExternalLink element at the specified index.

Type: ExternalLink

add(fileName, sheetNames) (1 of 2)

Adds an external link.

ParameterTypeDescription
fileNameStringThe external file name.
sheetNamesString[]All sheet names of the external file.

Returns: The position of the external name in this list.


add(directoryType, fileName, sheetNames) (2 of 2)

Add an external link .

ParameterTypeDescription
directoryTypeNumberA DirectoryType value. The directory type of the file name.
fileNameStringthe file name.
sheetNamesString[]All sheet names of the external file.

Returns: The position of the external name in this list.

clear() (1 of 2)

Removes all external links.

When removing external links, all formulas that reference to them will be removed too because the references become invalid.


clear(updateReferencesAsLocal) (2 of 2)

Removes all external links.

If references are required to be updated, those references of external links in formulas will be changed to current workbook when it is possible. For example, one cell’s original formula is “=‘externalsource.xlam’!customfunction()”, after removing external links, the formula will become “=customfunction()”; When the original formula is “=’[externalsource.xlam]Sheet1’!$A$1”, according to whether there is one sheet with name “Sheet1” in current workbook: if true, the formula will become “=Sheet1!$A$1”; if false, the formula will become “=#REF!$A$1”. If references are not required to be updated, all formulas with references to external links will be removed too because those references become invalid.

ParameterTypeDescription
updateReferencesAsLocalbooleanWhether update all references of external links in formulas to references of current workbook itself.

removeAt(index) (1 of 2)

Removes the specified external link from the workbook.

When removing the external link, all formulas that reference to it will be removed too because the references become invalid.

ParameterTypeDescription
indexNumberthe index of the external link to be removed.

removeAt(index, updateReferencesAsLocal) (2 of 2)

Removes the specified external link from the workbook.

ParameterTypeDescription
indexNumberthe index of the external link to be removed.
updateReferencesAsLocalbooleanWhether update all references of given external link to reference of current workbook itself. Check clear(boolean) to get more details about this parameter.

iterator()

Get an enumerator that iterates through this collection.