Sequence and symmetry of hole injection in YBa2Cu3O6+x in situ and ex situ experiments on powders and single crystals using X-ray absorption spectroscopy