Electronic devices made from carbon nanotubes (CNTs) can be greatly affected by substrate charges, which, for instance, induce strong hysteresis in CNT field effect transistors. In this work, electrostatic force microscopy (EFM) is employed to investigate single-walled nanotubes grown by chemical vapor deposition on SiO2 substrates. We demonstrate the use of this technique to gain quantitative information on the substrate charges. It is found that charge pools with densities around 10(-8) C/cm2 can be trapped inside nanotube loops for extended periods of time, showing that nanotubes can act as confining barriers for substrate charges. The trapped charges can be removed by scanning probe manipulation.