The Google API referenced in the accepted answer is deprecated. As of year 2025 there is another simple method to know own Google id:
- Log in to your Google account if not already
- Go to https://myaccount.google.com/data-and-privacy
- Locate the button Maps Timeline in the History settings, right-click on it and copy its URL
- That URL contains 'gid' parameter which is your Google ID.
Hope this helps the folks looking for their google user id in 2025.