Transverse momentum integrated and differential $J/\ensuremath{\psi}\phantom{\rule{4pt}{0ex}}{R}_{AA}$ are systematically studied in Au-Au collisions at energies selected for the beam energy scan at the BNL Relativistic Heavy Ion Collider using a transport approach, including cold and hot nuclear effects respectively in the initial conditions and the collision terms. With decreasing energy, while the temperature, lifetime, and size of the quark-gluon plasma (QGP) fireball decrease, the nuclear absorption of the initially produced charmonia is more and more strong, and the nuclear shadowing effect on charmonium regeneration goes to antishadowing first and then to shadowing again. As a competition between the cold and hot nuclear effects, the QGP phase is still important for charmonium production at $\sqrt{{s}_{NN}}=200$, 62.4, 54,4 and 39 GeV but becomes negligible at $\sqrt{{s}_{NN}}=14.5$ GeV.