Gilbert Gottfried was hard at work just a few weeks before his death -- and we've got video of one of his final on-screen appearances ... where he looks as spirited as ever.
The President of HollywoodOffices, Brad Folb, tells TMZ ... his company hired GG March 16 for a Cameo-styled ad through a company called Memmo -- which allows you to book celebs for any type of shout-out you might want.
In this case, HO was in the market for a personalized message from a "know-it-all" star who would be instantly recognizable -- and they quickly landed on Gilbert. Seeing how his voice is one of the most famous in La La Land ... they thought he'd be great.
Folb says they sent Gilbert instructions on what they were trying to communicate in the video -- namely, that you'd have to be a dummy not to rent office space from them -- but there was a no-rules rule in place for the guy ... so he could express that any way he saw fit.
Welp, Gil produced exactly that ... and did so with hilarious results. We're told the folks at HollywoodOffices were more than happy with what they got from him -- a gig that cost 'em about $1,300.
Seeing how a lot of their clients work in entertainment, Folb tells us he feels like Gilbert's ad was as good as it gets -- and, of course, it was so freakin' funny ... in true Gottfried fashion.
As you can see ... the dude looks and sounds like his old self, and surely seemed to be in high spirits -- which is why his passing was as shocking as it was. His family announced he'd died Tuesday after a long battle with a heart abnormality called Ventricular Tachycardia due to Myotonic Dystrophy type II.