How to calculate elevation gain for a route not recommended (by Google) for cycling
I highly recommend https://brouter.de/brouter-web for bicycle route planning. It also calculates elevation gain/loss and tries to avoid elevation changes.

Keep in mind that elevation data can be inaccurate since it’s usually using Digital Elevation Models which are based on satellite data. For example it might miss things like bridges entirely and display a huge elevation gain/loss for crossing a gorge. See https://brouter.de/brouter/elevation.html