This review highlights the use of the X-ray absorption spectroscopy (XAS) as a local structural tool for selected atoms in several host materials. The main characteristics of XAS to be element-sensitive and its applicability to all states of matter, including crystalline solids and amorphous and liquid states, permit an in-depth study of the structural properties of a large variety of materials. This includes intercalation materials where a host structure can accommodate guest species. Host guest equilibria are at the basis of a large variety of technological applications; in particular they have been used for energy storage, ion-exchange membranes, electrochromism, and analytical sensing. A selection of XAS experiments conducted in the field of batteries, mainly on cathodes, and applications in the field of metal hexacyanoferrates and double layered hydroxides are outlined.