The 79-year-old comedian and writer made the disclosure after being eliminated from the US version of The Masked Singer, saying he had gone on the programme to see if he could still perform.
Idle, who helped found Monty Python in 1969, was unmasked as a hedgehog after performing a cover of Love Me Do by The Beatles as part of the surreal TV talent show.
He told Time magazine: “About three years ago I was incredibly lucky: I was diagnosed with pancreatic cancer.
“Lucky? One of the most lethal forms of cancer, how on earth was that lucky? Well, because it was found incredibly early.”
He jokingly added: “No, not before lunchtime, but before it had gone anywhere.”
Idle recalled how he had asked his friend, the doctor David Kipper, “the quickest way to die” while conducting research for a play about a writer who is penning a musical about death when he discovers he is about to die.
In 2019, the same friend, who specialises in preventative medicine, helped diagnose Idle with pancreatic cancer.
After undergoing surgery at Cedars-Sinai hospital in Los Angeles, Mr Kipper told him: “Well, you’re in very good shape. The cancer hasn’t recurred. You should have about 10 years.”
Idle has now teamed up with Stand Up To Cancer in a bid to increase awareness for cancer research.
Speaking to Entertainment Weekly after being eliminated from The Masked Singer, he addressed his motivation for appearing on the show, which airs on ITV in the UK and Fox in the US.
He said: “I thought to myself, well, you better see if you can still do it, if you can still sing and dance.
“If you can actually go in front of a large audience and do something daft in costume. And so that, for me, became the motivation to do it.”
Alongside Graham Chapman, John Cleese, Terry Gilliam, Terry Jones and Sir Michael Palin, Idle helped steer the Monty Python comedy troupe to become one of the UK’s best known.
Chapman died in 1989 of tonsil cancer aged 48 while Jones died in 2020 aged 77 from a rare form of dementia.