Import XML to Excel workbook
Aspose.Cells for Python via .NET allows you to import the XML map inside the workbook using the Workbook.import_xml() method. You can import XML Map using the Microsoft Excel with the following steps
- Select Developer tab
- Click Import in the XML section and follow the required steps.
You will need to provide your XML data to complete the import. Here is a sample XML data that you can use for testing.
Import XML Map using Microsoft Excel
The following screenshot shows how to import XML Map using Microsoft Excel.
![]() |
---|
Import XML Map using Aspose.Cells for Python via .NET
The following sample code shows how to make use of the Workbook.import_xml(). It generates the output excel file as shown in this screenshot.
![]() |
---|
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(".") | |
# Create a workbook | |
workbook = Workbook() | |
# URL that contains your XML data for mapping | |
XML = "http://www.aspose.com/docs/download/attachments/434475650/sampleXML.txt" | |
# Import your XML Map data starting from cell A1 | |
workbook.import_xml(XML, "Sheet1", 0, 0) | |
# Save workbook | |
workbook.save(dataDir + "output_out.xlsx") |