{"id":4845,"date":"2016-12-04T07:50:42","date_gmt":"2016-12-04T07:50:42","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/wp\/?p=4845"},"modified":"2017-07-18T12:48:57","modified_gmt":"2017-07-18T12:48:57","slug":"google-map-in-excel-using-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/","title":{"rendered":"VBA to Add Static Google Map in Excel Sheet"},"content":{"rendered":"

Dear Readers,<\/p>\n

In this article, I am going to give you a quick tip – how can you add google map in your excel workbook without opening the google map in any browser. More details about this will follow…
\nTo do that I am using Google Static Map API<\/strong><\/a>. I am not going explain you more about this API here as you can already get whole lot of information about this API here on this page… Click here…<\/strong><\/a> At the end of this article you will find a downloadable workbook like below. Where you will be able to generate different Cities map or different type.<\/p>\n

\"Google

Google map generator<\/p><\/div>\n

Google Static Map API uses a URL which should be in this format: (copied from the above google documentation page)<\/p>\n

https:\/\/maps.googleapis.com\/maps\/api\/staticmap?parameters<\/i><\/strong><\/p><\/blockquote>\n

Parameters<\/h2>\n

There are many possibilities of parameters which can be provided in order to generate your map.. again more details you can find it on above page<\/p>\n

For example I am going to take a very basic map of any city of the world and show you how to use this API in excel.<\/p>\n

I promise you, it is the simplest code you would ever see to use it in excel for such a cool thing.<\/p>\n

Step 1. A Placeholder to keep your generated Map<\/h1>\n

Add a rectangle shape (ofcourse you can choose whatever shape you prefer) in your sheet any where you want to display the map and resize it according to your need.<\/p>\n

\"Add<\/a>

Add a Shape for Map<\/p><\/div>\n

Note:<\/strong>You can provide a name to that shape so that you can refer it in your by a relevant name. This is not a mandatory thing to do.<\/i><\/p>\n

How to provide a name to the Shape in Excel – you added above?<\/h1>\n

Follow below instruction to do so…<\/p>\n

\"How<\/a>

How to Name a Shape in Excel<\/p><\/div>\n

Step 2. Generate URL for Google Static Map API<\/h1>\n

Form your URL based on different parameters you would like. For example to generate the Map of Amsterdam City in 400X400 size with Zoom Level: 14, following would be the URL.<\/p>\n

[one_full spacing=”yes” last=”no” center_content=”no” hide_on_mobile=”no” background_color=”#FEF6D2″ background_image=”” background_repeat=”no-repeat” background_position=”left top” link=”” hover_type=”none” border_position=”all” border_size=”1.5px” border_color=”#EDDB93″ border_style=”solid” padding=”10px” margin_top=”” margin_bottom=”” animation_type=”0″ animation_direction=”down” animation_speed=”0.1″ animation_offset=”” class=”” id=””]https:\/\/maps.googleapis.com\/maps\/api\/staticmap?center=Amsterdam&zoom=14&size=400\u00d7400[\/one_full]<\/p>\n

Note: To check whether your URL is correct or not, you can simply open this URL as it is in any browser. If you see a static map images generated, that means your URL is correct and you can go ahead and use it in your Excel VBA code.<\/p>\n

Step 3. VBA Code to display Google Static Map<\/h1>\n

VBA code to execute to display the City map of Amsterdam in the rectangle shape<\/p>\n

\r\nSub insertMap()\r\n    ' prepare your google static map API\r\n    gAPIMapUrl = "https:\/\/maps.googleapis.com\/maps\/api\/staticmap?center=Amsterdam&zoom=12&size=640x640"\r\n    Shapes("your Shape Name").Fill.UserPicture gAPIMapUrl\r\nEnd Sub\r\n<\/code><\/pre>\n

Now you know how to include a map in your excel sheet using excel vba and Google Static Map API?<\/p>\n

Based on the above explanation, I have created a sample workbook, which you can download and play around with it.<\/p><\/blockquote>\n

Download Sample MAP Generator Excel<\/h1>\n

Download this, use it and do not forget to provide me your feedback by typing your comment here or sending en email or you can tweet me <\/a> You can also share it with your friends, colleagues or whomsoever you want to!!<\/p>\n\n<\/span>","protected":false},"excerpt":{"rendered":"

Dear Readers, In this article, I am going to give you a quick tip – how can you add google map in your excel workbook without opening the google map in any browser. More details about this will follow… To do that I am using Google Static Map API. I am not going explain you […]<\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1246,1675],"tags":[],"class_list":["post-4845","post","type-post","status-publish","format-standard","hentry","category-macro","category-excel-macro-for-beginners"],"yoast_head":"\nMacro to Add Google Map of your City dynamically - In Excel<\/title>\n<meta name=\"description\" content=\"Generate Google Static map in your excel sheet dynamically. VBA code to generate map using google map API. Download Google map generator Excel for your City.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VBA to Add Static Google Map in Excel Sheet\" \/>\n<meta property=\"og:description\" content=\"Generate Google Static map in your excel sheet dynamically. VBA code to generate map using google map API. Download Google map generator Excel for your City.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\" \/>\n<meta property=\"og:site_name\" content=\"Let's excel in Excel\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-04T07:50:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-07-18T12:48:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/learnexcelmacro.com\/wp\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif\" \/>\n<meta name=\"author\" content=\"Vishwamitra Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/learnexcelmacro\" \/>\n<meta name=\"twitter:site\" content=\"@learnexcelmacro\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishwamitra Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\"},\"author\":{\"name\":\"Vishwamitra Mishra\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"headline\":\"VBA to Add Static Google Map in Excel Sheet\",\"datePublished\":\"2016-12-04T07:50:42+00:00\",\"dateModified\":\"2017-07-18T12:48:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\"},\"wordCount\":668,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif\",\"articleSection\":[\"Excel Macro\",\"Excel Macro Tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\",\"name\":\"Macro to Add Google Map of your City dynamically - In Excel\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif\",\"datePublished\":\"2016-12-04T07:50:42+00:00\",\"dateModified\":\"2017-07-18T12:48:57+00:00\",\"description\":\"Generate Google Static map in your excel sheet dynamically. VBA code to generate map using google map API. Download Google map generator Excel for your City.\",\"breadcrumb\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vmlogger.com\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Macro\",\"item\":\"https:\/\/vmlogger.com\/excel\/macro\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"VBA to Add Static Google Map in Excel Sheet\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\",\"url\":\"https:\/\/vmlogger.com\/excel\/\",\"name\":\"Let's excel in Excel\",\"description\":\"Let's share knowledge\",\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vmlogger.com\/excel\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\",\"name\":\"Vishwamitra Mishra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"width\":528,\"height\":560,\"caption\":\"Vishwamitra Mishra\"},\"logo\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\"},\"description\":\"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.\",\"sameAs\":[\"http:\/\/www.learnexcelmacro.com\",\"http:\/\/www.facebook.com\/vmlogger\",\"https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro\",\"https:\/\/www.youtube.com\/c\/VMLogger\"],\"url\":\"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Macro to Add Google Map of your City dynamically - In Excel","description":"Generate Google Static map in your excel sheet dynamically. VBA code to generate map using google map API. Download Google map generator Excel for your City.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/","og_locale":"en_US","og_type":"article","og_title":"VBA to Add Static Google Map in Excel Sheet","og_description":"Generate Google Static map in your excel sheet dynamically. VBA code to generate map using google map API. Download Google map generator Excel for your City.","og_url":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/","og_site_name":"Let's excel in Excel","article_publisher":"http:\/\/www.facebook.com\/vmlogger","article_author":"http:\/\/www.facebook.com\/vmlogger","article_published_time":"2016-12-04T07:50:42+00:00","article_modified_time":"2017-07-18T12:48:57+00:00","og_image":[{"url":"http:\/\/learnexcelmacro.com\/wp\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif"}],"author":"Vishwamitra Mishra","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/learnexcelmacro","twitter_site":"@learnexcelmacro","twitter_misc":{"Written by":"Vishwamitra Mishra","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#article","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/"},"author":{"name":"Vishwamitra Mishra","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"headline":"VBA to Add Static Google Map in Excel Sheet","datePublished":"2016-12-04T07:50:42+00:00","dateModified":"2017-07-18T12:48:57+00:00","mainEntityOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/"},"wordCount":668,"commentCount":5,"publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif","articleSection":["Excel Macro","Excel Macro Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/","url":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/","name":"Macro to Add Google Map of your City dynamically - In Excel","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif","datePublished":"2016-12-04T07:50:42+00:00","dateModified":"2017-07-18T12:48:57+00:00","description":"Generate Google Static map in your excel sheet dynamically. VBA code to generate map using google map API. Download Google map generator Excel for your City.","breadcrumb":{"@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#primaryimage","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/01\/GIF.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/vmlogger.com\/excel\/2016\/12\/google-map-in-excel-using-vba\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vmlogger.com\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Macro","item":"https:\/\/vmlogger.com\/excel\/macro\/"},{"@type":"ListItem","position":3,"name":"VBA to Add Static Google Map in Excel Sheet"}]},{"@type":"WebSite","@id":"https:\/\/vmlogger.com\/excel\/#website","url":"https:\/\/vmlogger.com\/excel\/","name":"Let's excel in Excel","description":"Let's share knowledge","publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vmlogger.com\/excel\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5","name":"Vishwamitra Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","width":528,"height":560,"caption":"Vishwamitra Mishra"},"logo":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/"},"description":"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.","sameAs":["http:\/\/www.learnexcelmacro.com","http:\/\/www.facebook.com\/vmlogger","https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro","https:\/\/www.youtube.com\/c\/VMLogger"],"url":"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/"}]}},"_links":{"self":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/4845"}],"collection":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/comments?post=4845"}],"version-history":[{"count":0,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/4845\/revisions"}],"wp:attachment":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media?parent=4845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/categories?post=4845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/tags?post=4845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}