Set External Links in Formulas
Contents
[
Hide
]
Sometimes, it is necessary to include links to external files in formulas, for example, to evaluate a cell or range value against them. Aspose.Cells for Python via .NET provides this feature and this document explains how to use it.
The sample code below shows how to include external files in formulas.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Instantiate a new Workbook. | |
workbook = Workbook() | |
# Get first Worksheet | |
sheet = workbook.worksheets[0] | |
# Get Cells collection | |
cells = sheet.cells | |
# Set formula with external links | |
cells.get("A1").formula = "=SUM('[" + dataDir + "book1.xlsx]Sheet1'!A2, '[" + dataDir + "book1.xlsx]Sheet1'!A4)" | |
# Set formula with external links | |
cells.get("A2").formula = "='[" + dataDir + "book1.xlsx]Sheet1'!A8" | |
# Save the workbook | |
workbook.save(dataDir + "output_out.xlsx") |