This can be proved using Morera's theorem, which states that if $f$ is a continuous function defined on an open set $D$ such that the integral around every simple closed curve is 0, then the function is holomorphic on $D$.
To show that the integral around any simple closed curve is zero, it is sufficient to consider only very simple curves such as rectangles or triangles. Furthermore, it is clear that we only have to show this is true for curves which either pass through $a$ or go around $a$, because we know $f$ is holomorphic on $B(a;R)\setminus\{a\}$.
There are some different cases to consider, but the argument goes like this... Choose $\epsilon>0$ let $M=\max_{z\in \overline{B(a;R/2)}}\{|f(z)|\}.$ Continuity of $f$ ensures that this is well defined. Now choose $r$ such that $0. Let $\Gamma$ be any triangle contained in $B(a; r)$. It follows that $\int_\Gamma f(z)\,dz\leq M(6r)<\epsilon.$ Thus, by rewriting the integral around any simple closed curve as a sum of integrals around simple closed curves contained in $B(a;R)\setminus\{a\}$ and one integral around an appropriately small triangle around $\{a\}$, this shows that the integral is zero, and Morera's theorem finishes the argument.