SrRuO$_3$ (SRO) films are known to exhibit insulating behavior as their thickness approaches four unit cells. We employ electron energy$-$loss (EEL) spectroscopy to probe the spatially resolved electronic structures of both insulating and conducting SRO to correlate them with the metal$-$insulator transition (MIT). Importantly, the central layer of the ultrathin insulating film exhibits distinct features from the metallic SRO. Moreover, EEL near edge spectra adjacent to the SrTiO$_3$ (STO) substrate or to the capping layer are remarkably similar to those of STO. The site$-$projected density of states based on density functional theory (DFT) partially reflects the characteristics of the spectra of these layers. These results may provide important information on the possible influence of STO on the electronic states of ultrathin SRO.