How To Display SharePoint List Items on a Google Map

This post demonstrates the display of SharePoint list items on a map using JSLink and the Google Maps JavaScript API. In the steps that follow, we will create a new custom list named Companies. The Title field will hold the company name and a new column named Location will hold the company address information. We will use a Content Editor Web Part placed above the list view as the container for the map. JavaScript will be used to call the Google API for generating the map, obtaining the geolocation of each list item’s location, and adding the markers to the map. JSLink is used to associate the JavaScript with the list view which is executed client-side during the list view’s rendering process (client-side rendering).



Google Maps API Key – if you want to follow along and implement the solution on your own you will need an API key from Google.



SharePoint 2013, Office 365* *JSLink is not supported in the Office 365 modern site experience. Microsoft recommends SPFx when developing custom solutions for modern sites.

Disclaimer: The solutions in this series are not intended to provide a complete, best practices, or warranted solution, but are intended to demonstrate possibilities and provide you with examples that you can begin to build upon. Do not attempt exercises in a production environment. Any use of the information contained in this article is strictly at your own risk. If you need additional SharePoint support or advisory hours, please don’t hesitate to contact IncWorx. We’re here to help you get the most out of SharePoint.


Step By Step Guide to Display SharePoint List Items on a Google Map

Step 1: Create New “Companies” List

Go to Site Contents, click New and choose List.

add SharePoint list


Step 2: Name the “Companies” List 

Name the list “Companies” and click the Create button.

create SharePoint list


Step 3: Add A New Column

Add a new Single line of text column.

add SharePoint column text


Step 4: Create “Location” Column

Name the column “Location” and click the Create button.

SharePoint new text column


Step 5: Populate “Companies” List

Populate the “Companies” list with sample company names and locations.

sample SharePoint list company names locations


Step 6: Create JSLinkMapView.js File

Using your favorite editor create and save a file named JSLinkMapView.js and add the following code.

Note: be sure to enter your own Google API key!

function RegisterCustomOverrides() {
var obj = {};
obj.Templates = {};
obj.Templates.OnPostRender = LoadMap;
function LoadMap(ctx) {
var mapOptions = {
center: new google.maps.LatLng(42, -88),
zoom: 6
var map = new google.maps.Map(document.getElementById(“map-canvas”), mapOptions);
var geo = new google.maps.Geocoder();
var bounds = new google.maps.LatLngBounds();
var rows = ctx.ListData.Row;
var idx = 0;
for (var i = 0; i < rows.length; i++) {
geo.geocode({‘address’:rows[i][“Location”]},function(results, status) {
new google.maps.Marker({map: map, position: results[0].geometry.location, title: rows[idx++].Title});
RegisterModuleInit(“/SiteAssets/JSLinkMapView.js”, RegisterCustomOverrides);


Step 7: Upload JSLinkMapView.js File


Upload the JSLinkMapView.js file to the Site Assets document library of your site.

upload jslink SharePoint site assets library


Step 8: Change View to Classic SharePoint

Return to the “Companies” list and click Return to classic SharePoint.

Note: At the time of this writing Microsoft’s new “modern pages” do not support many of SharePoint’s customization features including JSLink.

return to classic SharePoint


Step 9: Edit The SharePoint Page

From the Site Actions menu choose Edit Page.

SharePoint edit list view page


Step 10: Add A Content Editor Web Part

  • Click Add Web Part
  • Choose Media and Content
  • Choose Content Editor
  • Click Add

SharePoint add content editor web part


Step 11: Edit The Content Editor Web Part Code

With the Content Editor Web Part now added above the list items, click to edit the web part and activate the ribbon options, then choose Edit Source.

SharePoint content editor edit source


Step 12: Create Container for Google Map

Paste the following in the Content Editor Web Part Source window and click the OK button.  You have now created the container for the Google map.

container SharePoint Google map


Step 13: Edit Google Map Container

Click Edit Web Part from the list view web part’s context menu.

SharePoint content editor edit web part


Step 14: Update Miscellaneous JSLink Field

Expand Miscellaneous and paste the following in the JSLink field and click OK:


SharePoint add jslink list view


Step 15: Finish Up Editing

Click the Stop Editing button on the ribbon.

SharePoint stop editing page


View SharePoint List Items on a Google Map!

SharePoint list items Google map


I hope you’ve enjoyed this brief introduction to JSLink. Thanks for reading!

Related Articles to Help Grow Your Knowledge

Microsoft Teams Adoption Strategy: 5 Critical Considerations
Microsoft Teams Adoption Strategy: 5 Critical Considerations

Microsoft Teams is growing at an incredible rate. In October of 2020, Microsoft reported a 50 percent rise in daily active users from the numbers six months prior. More and more IT business strategies include implementing Teams as a hub for communication and...

Microsoft RPA: Get More Done With Robotic Process Automation
Microsoft RPA: Get More Done With Robotic Process Automation

Every business runs into mundane, time-consuming tasks every now and then. Maybe your team members keep repeating the same navigation steps, clicking the same buttons, just to pull a report. Or perhaps they're constantly forced to look up information in one app so...

Is Power BI Good For Big Data?
Is Power BI Good For Big Data?

The rise of Power BI from a little-known platform to one of the most powerful business analytics tools in the world is nothing short of spectacular. In just under seven years, Power BI has accrued more than 5 million subscribers, a feat that lays testament to just how...

Join over 1,000 people who receive insights, guides and advice for Microsoft technologies every month.