Excel spredsheet to kml file

289 views
Skip to first unread message

Silvia

unread,
Sep 24, 2007, 11:07:16 AM9/24/07
to KML Developer Support - Third Party Applications
Hello!

I am trying transform an excel table (with of a size 12x43) into a kml
file, but i can't transform the table into csv or txt format because
it will lose its format. And i want this table to apear as a
placemark. Is there a way to do this automaticly in the excel
spreadsheet without transform the table into an html file???

Thank you a lot for the help
Silvia

ManoM

unread,
Sep 25, 2007, 10:09:47 AM9/25/07
to KML Developer Support - Third Party Applications
Hi Silvia,

Do you mean you have a chart generated in Excel that you want to
appear in a Placemark? The only way to get the chart exactly as you
have it would be to save it as an image file and put that in the
description balloon.

ManoM

Silvia

unread,
Sep 25, 2007, 1:50:27 PM9/25/07
to KML Developer Support - Third Party Applications
Hello Mano,

Thank you for answer,
I am doing a excel tool that analyses different enviornmental risk in
different locations on the earth. This tool will be used for several
people and therefore i wanted it to be user friendly, so i would like
to create a macro that would transform this final table of the tool
that gives the several risks into a kml file.

Regards
Silvia

> > Silvia- Hide quoted text -
>
> - Show quoted text -

Silvia

unread,
Sep 25, 2007, 1:57:50 PM9/25/07
to KML Developer Support - Third Party Applications
Hello again,

I am trying to do this in VBA and i already saw the macro that Simon_a
generated, but in this macro they use a very simple description of
just one cell, my question would be if it is possible to create a
macro similar to this but to genarate the entire table. And right now
i have no idea how to do this! So i would apreciate any possible help!

Silvia

> > - Show quoted text -- Hide quoted text -

ManoM

unread,
Sep 25, 2007, 4:15:47 PM9/25/07
to KML Developer Support - Third Party Applications
Hi Silvia,
tekgergedan has posted about his Excel to KML tool:
http://groups.google.com/group/kml-support-third-party-applications/browse_thread/thread/86557ce4448c7e40#

This may be too simple for what you're looking for, but there's also a
tutorial online about using a Google Spreadsheet (not Excel) to create
KML:
http://earth.google.com/outreach/tutorial_spreadsheet.html

If neither of those work for you, it shouldn't be too hard to do it in
VBA, though I haven't worked much in VBA for years now. Basically you
just need to generate an HTML table. A quick Google search:
http://www.google.com/search?q=VBA+Excel+HTML+Table
yields a lot of promising looking samples. While I can't vouch for any
of these sites, it shouldn't be too hard to find some code already
written. If you decide to go down this route, here's some things to
think about:

1) You just need the HTML table, not the full HTML document, and you
need it inside your KML.
2) I'm guessing that every row will end up as a Placemark. In that
case, you're going to want output that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Folder>
<Placemark>
<name>Placemark 1</name>
<description><![CDATA[<table border="1" padding="3" width="300">
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
</table>]]>
</description>
<Point>
<coordinates>1,1</coordinates>
<Point>
</Placemark>
<Placemark>
<name>Placemark 1</name>
<description><![CDATA[<table border="1" padding="3" width="300">
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
<tr><td>Data Name</td><td>Some Value</td></tr>
</table>]]>
</description>
<Point>
<coordinates>1,1</coordinates>
<Point>
</Placemark>
</Folder>
</kml>

That's the simple version. The more complex version, which would
actually save some space, is using ExtendedData. For more information
on that, check out this page:
http://code.google.com/apis/kml/documentation/extendeddata.html

ManoM

Silvia

unread,
Sep 25, 2007, 5:00:09 PM9/25/07
to KML Developer Support - Third Party Applications
Thank you very much!
This was really helpfull.
Later I will tell you the result!

Regards ansd thanks once more
Silvia

On Sep 25, 11:15 pm, ManoM wrote:
> Hi Silvia,

> tekgergedan has posted about his Excel to KML tool:http://groups.google.com/group/kml-support-third-party-applications/b...

Reply all
Reply to author
Forward
0 new messages