# Load Files

Work with Spread for WPF to load files from different formats.

## Content

You can open files of different formats into the Spread for WPF, where you can analyze the data or make any changes. Supported file formats include Excel files and XML data files.
This topic provides the methods for opening several file types.

## Supported Formats

### Load an Excel File

To open an existing Excel workbook, you can use the [OpenExcel](/spreadnet/api/latest/online-wpf/GrapeCity.Wpf.SpreadSheet/GrapeCity.Wpf.SpreadSheet.GcSpreadSheet.OpenExcel.html) method of the **GcSpreadSheet** class. This method opens the specified Excel in the GcSpreadSheet control and replaces the current workbook with the newly opened workbook.
Refer to the following example code to open an Excel file using a filename.
**C#**

```csharp
// Open an Excel file.
spreadSheet1.OpenExcel(@"D:\TestFile.xlsx");
```

**VB**

```auto
' Open an Excel file.
spreadSheet1.OpenExcel("D:\TestFile.xlsx")
```

### Load an XML File

To load and open an XML data file in a workbook, use the [OpenXML](/spreadnet/api/latest/online-wpf/GrapeCity.Spreadsheet/GrapeCity.Spreadsheet.IWorkbooks.OpenXML.html) method of the **IWorkbooks** interface which accepts string type filename/stream as its parameter. It returns a new workbook in the same workbook set but does not replace the data of the current workbook. You need to keep the reference to the new workbook to perform further operations.
The following example code opens an XML data file using a filename.
**C#**

```csharp
// Open an XML data file.
var book2 = spreadSheet1.Workbook.WorkbookSet.Workbooks.OpenXML(@"D:\\DataFormat.xml");
MessageBox.Show(book2.Worksheets[0].Cells["A1"].Value.ToString());
```

**VB**

```auto
' Open an XML data file.
Dim book2 = spreadSheet1.Workbook.WorkbookSet.Workbooks.OpenXML("D:\\DataFormat.xml")
MessageBox.Show(book2.Worksheets(0).Cells("A1").Value.ToString())
```