This article talks about How to Create KML file from Excel file in MS Excel. By following this article, you can create a KML file from geographic data inside Excel sheet. For this purpose, we going to use macro inside Excel. Don’t worry, you don’t have to define a macro yourself. Follow this link and download the predefined macro-enabled excel file from there. This file will do all the stuff for you, you just have to enter the geographic data, like Longitude, latitude, etc.
You can also do the same with the help of a free XLS to KML Converter, follow Free XLS to KML Converter JXLStoKML tutorial for step by step guide to do that.
Before You Begin:
Before using this Excel file, make sure macros are enabled in your MS Excel. You can check/enable that by following these simple steps:
Open MS Excel and select a blank workbook. Then, go to File -> Options. In the options menu, click on Trust Center from the left side panel. Click on the Trust Center Settings in the Trust Center window, present under Microsoft Excel Trust Center. The screenshot below can be seen for help.
Now from the left panel go to Macro Settings to enable all macros. Also, the Trust Access box needs to be checked.
At this point, you enabled the macros in your MS Excel. Now, let’s see how you can generate KML file from an Excel sheet.
How To Create KML File from Excel File In MS Excel?
For this purpose, follow this link and download macro enable Excel file. You can easily create KML file from Excel using this Excel sheet. This Excel file contains two sheets, Sheet1 and Sheet2.
This sheet is for the data. Here, you will see some templates of geographic data. Feel free to delete those entries and enter your data. Follow the same structure though (1st row for Name, 2nd for Longitude, 3rd for Latitude, and 4th for Description). Enter the Longitude and Latitude data in their respective columns. You can define a name for a particular location in its respective column. A description can also be defined under Description column for the locations.
You don’t have to do anything on this sheet. It holds XML data for creating the KML file. But, you can define a name along with destination folder for the KML file in the first row (C:\myfile.kml). As you can see, the created KML file will be saved in C drive with the name myfile.kml.
Create KML File from Excel:
After entering your data in the Sheet1, press ALT+F8 for accessing the macros. This will open a Macro popup on your screen. Select the generateXML macro and click on Run. This will create a KML file respective to your data in the location defined in Sheet2 i.e. C drive (by default).
If you experience any file access error, that is because the file doesn’t have permission to write in C drive (generally happens in Windows 10). In that case, just enter another directory in the 1st row of Sheet2, like, E:/myfile.kml or D:/myfile.kml, etc.
With the help of this macro-enabled Excel file, you can create KML file from Excel file within MS Excel. The process is straightforward and easy to follow. You can do this for as many entries as you want.