I'm trying to find the expression of the divergence of a vector field $\vec{E}$ in spherical coordinates from the theorem :
$$\iint_{S(V)}(\vec{E}.\vec{n})dS = \iiint_{V}div(\vec{E})dV$$
but if I write $\vec{E}$ in spherical coordinates:
$$\vec{E} = E_r\vec{e_r}+E_{\phi}\vec{e_{\phi}}+E_{\theta}\vec{e_{\theta}}$$
and if I consider a spherical volume and its surface, I find that $\vec{n} = \vec{e_r}$ since $\vec{n}$ is orthogonal to the spherical surface at any point... So I'm left with $(\vec{E}.\vec{n}) = E_r$ and
$$\iint_{S(V)}E_rdS = \iiint_{V}div(\vec{E})dV$$
I don't understand how I'm supposed to get to $$div(\vec{E}) = \frac{1}{r^2}\frac{\partial (r^2 E_r)}{\partial r} + \frac{1}{r sin\theta}\frac{\partial E_\phi}{\partial\phi}+\frac{1}{r sin\theta}\frac{\partial(sin\theta E_{\theta})}{\partial \theta}$$
I assume you have some familiarity with the calculus of differential forms in $\mathbb{R}^3$ $\newcommand{\bR}{\mathbb{R}}$ $\newcommand{\ii}{\boldsymbol{i}}$ $\newcommand{\jj}{\boldsymbol{j}}$ $\newcommand{\kk}{\boldsymbol{k}}$ Suppose
$$E= E_x\ii+E_y\jj+E_z\kk. $$
We associate to it the differential $2$-form
$$\Phi_E= E_x dy\wedge dz+E_y dz\wedge dx +E_z dx\wedge dy.$$
Convert it to spherical coordinates, then take the exterior derivative. You will obtain something that has the form $\newcommand{\vfi}{\varphi}$
$$w(r, \theta, \vfi) dr\wedge d\theta\wedge d\vfi. $$
The divergence of $E$ is the quantity
$$\frac{w(r,\theta,\vfi)}{r^2\sin\vfi}. $$