How to count how many photos you have in Google Photos

I'm in the process of copying all my photos from over the years to Google Photos. They currently reside in Apple Photos, which reports exactly how many photos I have. But this seems to be a feature missing from Google Photos. I'm using the Google Photos Backup utility to upload all the photos, and it reports a count. But to be extra confident I'd like to see a count of how many are actually in Google Photos now. This article is about how I was able to get a count of photos from Google Photos.

I built a Google Spreadsheet with some scripting in Google Apps Script to do this. This spreadsheet relies upon the feature of Google Drive that lets you make your Google Photos accessible as a folder in Google Drive. So before using this spreadsheet you need to enable that feature as follows. In Google Drive click Settings in the upper right and then scroll down and check the box alongside "Create a Google Photos folder"
Now click the following link and copy the spreadsheet to your account: Google Photos Count spreadsheet.

When your copy of the spreadsheet opens you'll notice an extra menu item on the toolbar for "Photos". On that menu there will be one entry for "Count". Click this and it will ask you to authorize access to your Google Spreadsheet and your Google Drive. Click to authorize and after a moment or two (longer if you have a lot of photos) it will add a row to the spreadsheet with a timestamp and a count.

Basically the code looks for a folder named "Google Photos" and then counts all the files inside it, and then recurses down into all the folders inside it repeating these steps. Although it's not obvious when you click the Google Photos folder inside Google Drive, the photos appear to be arranged in subfolders based on years. When I first tried to retrieve a list of files inside the Google Photos folder I received an empty list, but that's because everything is in subfolders.

Hopefully you find this useful. You can also schedule the script to run hourly so that it reports a running count while the upload is taking place. This can be done with a trigger added from the Script Editor.