Method 1 – Opening CSV File in Excel
- Open the CSV file in Excel.
- Note down the heading of each column. This will be required to create the XML template.
- For my dataset, they are the Name and Location columns.
Method 2 – Creating XML Template in Notepad
- Create a new template file with the extension .xml and open the file using any text editor.
- Type the following XML code in the text editor.
- Replace the words Name and Location with your own column headers.
- Change the words location_data and location to suit your dataset.
Method 3 – Importing Template into Excel
- Go to the Developer tab and under the XML section click on Source.
- Open the XML Source window, and click on XML Maps.
- In the new XML Maps window, click Add.
- In the Select XML Source window, select All Files from the File Types drop-down.
- Select the XML template file that you created and click Open.
- In the new message box, click OK.
- In the new window, you will see that Excel has added the template file as an XML map.
- Press OK.
- The column headers appear as a tree structure in the window XML Source.
- From the XML Source window, click and drag the Name section to cell B4, where the column header is.
- Drag and drop the Location section to cell C4.
- Excel will map the dataset and format it as shown below.
Method 4 – Exporting File in XML Format
- Navigate to the Developer tab, and from the XML section, click on Export.
- AfIn the new Export XML window, give the file a name and click on Export.
- Excel will export and save the file in XML format, and you can open it to check if the operation was successful.
Download Practice Workbook
You can download the practice workbook from here.
Related Articles
<< Go Back to Export Excel to XML | Export Data from Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!