Embed Map with a Marker on Web App on Google Sheets using Google Apps Script

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 12

  • @CodeWithCurt
    @CodeWithCurt  4 роки тому +6

    HTML and Javascript Code in Video:





    function loadAddresses()
    {

    google.script.run.withSuccessHandler(function(ar)
    {
    var addressesSelect = document.getElementById("addresses");
    console.log(ar);

    let option = document.createElement("option");
    option.value = "";
    option.text = "";
    addressesSelect.appendChild(option);

    ar.forEach(function(item, index)
    {
    let option = document.createElement("option");
    var location = item[0];
    var streetAddress = item[1];
    var city = item[2];
    var state = item[3];
    var zip = item[4];
    option.value = streetAddress + ' ' + city + ', ' + state + ' ' + zip;
    option.text = location;
    addressesSelect.appendChild(option);
    });

    }).getList();

    };

    function onSelect()
    {

    var address = document.getElementById("addresses").value;
    google.script.run.withSuccessHandler(function(ar)
    {

    console.log(ar);
    ar.forEach(function(item, index)
    {

    document.getElementById('locationMap').innerHTML = "";

    var map = L.map('map',{
    center: [item[0], item[1]],
    zoom: 15
    });
    L.tileLayer('{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '© OpenStreetMap contributors'
    }).addTo(map);

    var marker = L.marker([item[0], item[1]]).addTo(map);

    });

    }).getAddress(address);

    }



    Pick Location:  

    loadAddresses();

  • @carlosmolina3144
    @carlosmolina3144 3 роки тому

    hOLA Curt, estoy muy agradecido por compartirme tus conocimientos!

  •  Рік тому

    Hello, congratulations for your excellent work, one question, how can I show all the points, and use filters with some data from the google sheets sheet, greetings always...

  • @FrancescoCotroneo1
    @FrancescoCotroneo1 4 роки тому +1

    Hi. Very useful video, thanks. You said you would post the code here in the comments. Will you?

    • @CodeWithCurt
      @CodeWithCurt  4 роки тому

      The code is posted in one of the comments below the video.

  • @Maxneo44
    @Maxneo44 3 роки тому

    Hello, I'm not very good with google api and leafletjs: /
    I just want to get my addresses with a name and all of them displayed on the map at the same time.
    could you help me? or a track to follow?
    thank you in advance

    • @shalomg8871
      @shalomg8871 Рік тому

      Same ⬆

    • @shalomg8871
      @shalomg8871 Рік тому

      Did you ever figure out a solution to this?

    • @Maxneo44
      @Maxneo44 Рік тому

      @@shalomg8871 I switched to the Google maps api...

  • @jhicinternational
    @jhicinternational 4 роки тому

    thanks !

  • @kamalrajm1598
    @kamalrajm1598 4 роки тому

    Hello ... It would be very helpful if you could let us know how to save a range as PDF and send via whatsapp