You wrote as a comment that: "I know that electric field due to charges outside of the closed surface doesn't contribute to net flux but I don't see how it answers my question."
OK, first take a single unit point charge a draw and sphere around it. Its flux is the integral $\Phi_0 = \oint \frac{1}{4\pi} \frac{\mathbf r^0}{r^2}\cdot d\mathbf A $ but from the radial symmetry you have since $d\mathbf A = \mathbf r^0 dA$ and $A=4\pi r^2$ therefore $\Phi_0 = 1$, one unit charge.
Now take an arbitrary closed surface $\mathcal A$ containing a single unit charge and draw a small enough sphere $\mathcal S$ that is completely within that surface $\mathcal A$ and also contains the same unit charge. Also let $\mathcal B $ denote the surface of the rest of the volume, $\mathcal B = \mathcal A - \mathcal S$. The flux through $\mathcal S$ is $1$ while through $\mathcal B$, as you already know, is $0$, hence the flux through $\mathcal A$ is $1$.
Now if you have an arbitrary charge distribution break that up into small almost point like infinitesimal pieces and add up their individual infinitesimal fluxes associated with the closed surface that contains all of them. The result it is Gauss's law.