Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Often Excel files access data from other Excel files using external links. Aspose.Cells for Node.js via C++ provides the option to retrieve these external links by using the Name.getReferredAreas(boolean) method. The Name.getReferredAreas(boolean) method returns an array of type ReferredArea. The ReferredArea class provides a ReferredArea.getExternalFileName() property which returns the name of the external file. The ReferredArea class exposes the following members.
The sample code given below demonstrates the use of the Name.getReferredAreas(boolean) method to get ranges with external links.
try
{
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// Source directory
const sourceDir = path.join(__dirname, "data");
// Load source Excel file
const filePath = path.join(sourceDir, "SampleExternalReferences.xlsx");
const workbook = new AsposeCells.Workbook(filePath);
console.log(filePath);
const names = workbook.getWorksheets().getNames();
const namesCount = names.getCount();
for (let i = 0; i < namesCount; i++)
{
const namedRange = names.get(i);
const referredAreas = namedRange.getReferredAreas(true);
if (referredAreas)
{
referredAreas.forEach(referredArea => {
// Print the data in Referred Area
console.log("IsExternalLink: " + referredArea.isExternalLink());
console.log("IsArea: " + referredArea.isArea());
console.log("SheetName: " + referredArea.getSheetName());
console.log("ExternalFileName: " + referredArea.getExternalFileName());
console.log("StartColumn: " + referredArea.getStartColumn());
console.log("StartRow: " + referredArea.getStartRow());
console.log("EndColumn: " + referredArea.getEndColumn());
console.log("EndRow: " + referredArea.getEndRow());
});
}
}
}
catch (e)
{
console.error(e);
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.