  Cosmological constraints on the scalar-tensor theory of gravity by analyzing
the angular power spectrum data of the cosmic microwave background (CMB)
obtained from the Planck 2015 results are presented. We consider the harmonic
attractor model, in which the scalar field has a harmonic potential with
curvature ($\beta$) in the Einstein frame and the theory relaxes toward the
Einstein gravity with time. Analyzing the {\it TT}, {\it EE}, {\it TE} and
lensing CMB data from Planck by the Markov chain Monte Carlo method, we find
that the present-day deviation from the Einstein gravity (${\alpha_0}^2$) is
constrained as ${\alpha_0}^2<2.5\times10^{-4-4.5\beta^2}\ (95.45\% {\rm\
C.L.})$ and ${\alpha_0}^2<6.3\times10^{-4-4.5\beta^2}\ (99.99\%\ {\rm C.L.})$
for $0<\beta<0.4$. The time variation of the effective gravitational constant
between the recombination and the present epochs is constrained as $G_{\rm
rec}/G_0<1.0056\ (95.45\% {\rm\ C.L.})$ and $G_{\rm rec}/G_0<1.0115\ (99.99
\%{\rm\ C.L.})$. We also find that the constraints are little affected by
extending to nonflat cosmological models because the diffusion damping effect
revealed by Planck breaks the degeneracy of the projection effect.
