The electronic properties of single-walled carbon nanotubes (SWCNTs) are known to be highly sensitive to environmental effects. Here, we use scanning tunneling microscopy and spectroscopy to investigate the electronic properties of SWCNTs deposited on RbI monolayer films grown on Au(111). We find that grain boundary defects in RbI monolayers cause the appearance of spatially confined localized states in the SWCNTs. Our density functional theory calculations show that grain boundary defects in RbI/Au(111) produce a stabilizing electrostatic potential caused by reduced coordination of iodine atoms at the RbI grain boundary. The presented results may offer insights into the performance of devices involving transport through SWCNTs subjected to external electrostatic disorder.