The other day at work I was asked if it was possible to automatically update a Google spreadsheet based on edits made in GIS. The spreadsheet would be shared with others who don’t have access to the GIS data and would always show the most up-to-date information. I knew that Google had an API that would be helpful for that, so I took on the challenge. I didn’t quite realize how tricky it would be at the time though…
Plan A: Download GIS data from ArcMap via arcpy and post on Google Sheets via python API. Sounds easy enough.
Failed ArcMap uses python 2.7, Sheets API requires 3+ (despite what the documentation says)
Plan B: OK, I guess I’ll make it in ArcGIS Pro, even though most of VDOT doesn’t use it. At least it’ll be python 3…
Failed A mystery problem prevented me from cloning the default environment in Pro, which prevented me from installing the Sheets API.
Plan C: Oh ok, I guess it’s better to work with ArcMap anyway since that’s what everyone here uses. I’ll just do it with .NET instead of python.
Failed for the same reason as Plan A, just with a different language.
Plan D: Wait, what if I make two scripts, one in python 2 to download the data and another in python 3 to post it? Then I could have the first script call the second one once the data is downloaded.
Success!
I doubt that this is by any means the best way to go about this, but it’s certainly one way that seems to work. After dropping the python 2 script as an add-in button in ArcMap, the editor can now make changes to the database in GIS, hit the button in the toolbar, and the Google Sheet will have all of the latest edits ready to be used by non-GIS users.