ExternalLinkCollection

ExternalLinkCollection class

Represents external links collection in a workbook.

Methods

NameDescription
add(fileName, sheetNames)Adds an external link.
add(directoryType, fileName, sheetNames)Add an external link .
clear()Removes all external links. When removing external links, all formulas that reference to them will be removed too becaus
clear(updateReferencesAsLocal)Removes all external links. If references are required to be updated, those references of external links in formulas wil
get(index)Gets the ExternalLink element at the specified index.
getCount()Gets the number of elements actually contained in the collection.
iterator()Get an enumerator that iterates through this collection.
removeAt(index)Removes the specified external link from the workbook. When removing the external link, all formulas that reference to i
removeAt(index, updateReferencesAsLocal)Removes the specified external link from the workbook.

add(fileName, sheetNames)

Adds an external link.

ParameterTypeDescription
fileNameStringThe external file name.
sheetNamesArray of StringAll sheet names of the external file.

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

add(directoryType, fileName, sheetNames)

Add an external link .

ParameterTypeDescription
directoryTypeNumberDirectoryType
fileNameStringthe file name.
sheetNamesArray of StringAll sheet names of the external file.

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

clear()

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)

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.

get(index)

Gets the ExternalLink element at the specified index.

ParameterTypeDescription
indexNumberThe zero based index of the element.

Returns: ExternalLink — ExternalLink The element at the specified index.

getCount()

Gets the number of elements actually contained in the collection.

iterator()

Get an enumerator that iterates through this collection.

Returns: Iterator — Iterator

removeAt(index)

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)

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