Yes, you can go to the top of Sagrada Familia by elevator. However, the lift doesn’t really bring you to the topmost floor. You’ll have to climb some steps to go to the uppermost part. The elevator is too small, and the steps are too narrow. That’s why you can’t