Pyrrole and indole derivatives are functionalizedviaa green initiative with the dimethyl malonate derived phenyl iodonium ylide4ain the presence of a blue LEDviaC-H functionalization of the respective heterocycles in methanol to generate the desired compounds5-7in moderate to good yields. Control experiments provide insight into the probable reaction mechanism. Finally, the strategy is successfully applied in the generation of azepino[4,5-b]indole12a/b. © The Royal Society of Chemistry 2021.