In this paper, we discuss the exclusive photoproduction of ground and excited states of ψð1S; 2SÞ and ϒð1S; 2SÞ in ultraperipheral collisions (UPCs). Using the potential model in order to obtain the vector meson wave function, we find a good agreement of our calculations with data from the LHC and HERA colliders for J=ψð1S; 2SÞ and ϒð1SÞ in γp collisions. We extend the calculations to the nuclear target case applying them to AA UPCs with the use of the shadowing and finite coherence length effects fitted to the data. Our results are compared to the recent LHC data, in both incoherent (J=Ψð1SÞ at 2.76 TeV) and coherent (J=Ψð1SÞ at 2.76 and 5.02 TeV) processes. We also show the corresponding predictions for the excited states, in the hope that future measurements could provide more detailed information about the vector meson wave functions and nuclear effects.