In the Tobey Maguire trilogy, Lee was a surprised bystander and a man dodging falling debris in the first two films before having a brief convo with Spidey in his third appearance as the hero.
In "The Amazing Spider-Man," Lee played a librarian, oblivious to a fight occurring behind him. In the next film, he was seen as a graduation guest who says he knows Peter Parker (Andrew Garfield).
In "Spider-Man: Homecoming" he played Gary, a man yelling out a window at Tom Holland's Spidey.
You can see all of Stan Lee's Marvel cameos here.