We study the formation of epitaxial graphene on Ru(0001) using fast x-ray photoelectron spectroscopy during the growth process. The assignment of different C 1s and Ru 3d core level components and their evolution during the growth process gives a detailed insight into the graphene formation and the strongly varying graphene-Ru interaction strength within the large moiré unit cell. Subsequent intercalation of oxygen can be achieved at elevated temperature and the core level spectra show a conversion of the strongly corrugated to quasi free-standing graphene, characterised by a single narrow C 1s component. This conversion and the accompanying flattening of the graphene layer is also confirmed by x-ray photoelectron diffraction. The effect of oxygen intercalation on the electronic structure is studied using angle-resolved photoemission of the valence band states. For graphene/Ru(0001), the strong graphene-substrate hybridisation disrupts the π-band dispersion but oxygen intercalation fully restores the π-band with a strong p-doping that shifts the Dirac point 785 meV above the Fermi level. The doping of the system is highly tunable, as the additional exposure to rubidium can convert the carrier filling to n-type with the Dirac point 970 meV below the Fermi level.