先上代码:
function generateMap() {
var address = "summer palace, beijing, china";
var mapUrl = Maps.newStaticMap()
.setMarkerStyle(Maps.StaticMap.MarkerSize.MID,
Maps.StaticMap.Color.RED,
"A")
.addMarker(address)
.setMarkerStyle(Maps.StaticMap.MarkerSize.MID,
Maps.StaticMap.Color.RED,
"B")
.addMarker("tsinghua university, beijing, china")
.setCenter(address)
.setSize(500, 500)
.getMapUrl();
var ui = UiApp.createApplication();
ui.setTitle("Map");
var panel = ui.createFlowPanel()
.setSize("500px", "500px");
panel.add(ui.createImage(mapUrl));
ui.add(panel);
ui.setHeight(500);
ui.setWidth(500);
SpreadsheetApp.getActiveSpreadsheet().show(ui);
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Show Map",
functionName : "generateMap"
}];
sheet.addMenu("Google Map", entries);
};
查看效果:https://docs.google.com/spreadsh ... VGc&usp=sharing
Tools --Script Editor下折腾代码吧。
|