Linking Leaflet Dropdown to Google Spreadsheet

Hi, I have remixed a Leaflet map and extended the app with a dropdown that will eventually contain categories of markers for the map. Now I want to read data from a live Google Spreadsheet by passing values from the sheet into an array in a JS file in Glitch.

To get the data into the app on Glitch, I am attempting to use this sample script .

To get PHP working with Glitch, I set up Composer using the console and that has worked. However, I am unsure where to take it from there. Is there a way to create and run a php script, and then read from that into the JS file? Or is this not something that is possible?

I also tried SpreadsheetGlitchMe but I get an error
“Site didn’t respond
Something in the code caused it to close the connection before providing a response.”
Although this might have something to do with current issues affecting Glitch’s API!

Thank you

Hi rootseire!

It looks like you’re trying to use PHP on Glitch. This is possible, but it’s not easy or straightforward. If you would like to continue down this path, you might try reading and/or remixing ~php-poc or ~lamp-poc.

If you want something convenient to use, you might try using Node instead of PHP. Node is easier to use on Glitch than other ecosystems at the moment.

To see how to fetch data from Google Sheets, you might look at!/caterwauling-libra?path=package.json:1:0 or any of the projects in this collection:

You might also like Lyzi Diamond’s ~make-a-map!/make-a-map? - there she adds a geojson data source which is - the idea would to instead add a data source which points to the server side of your Glitch app, and then server side can then reach out to Google Sheets, and rearrange the resulting rows to be valid geojson, and return it to the client side of your Glitch project.

Hope this helps,


php is supported?
in glitch()