Coel drew on her own experiences in a speech at the Edinburgh TV Festival to call out racism and sexual harassment in the industry.
The 30-year-old Bafta-winner, who has never spoken publicly about the assault before, revealed that she told her producers about the ordeal before her own family.
Coel said she asked them: “How do we operate in this family of television when there is an emergency?”
The actress made clear that her attacker had no links to the TV industry or the production she was working on.
Coel, who has been commissioned to write a BBC drama on sexual consent, also revealed she was harassed after winning her first big industry award.
She told the audience that she left in tears after she was sexually propositioned by an executive at an after-party.
In her speech she asked: “Could my silence have encouraged this producer to push boundaries with women and people of colour further?
“This thought is uncomfortable.”
Coel told the audience that being open about her experiences is therapeutic, and urged them to also be transparent and seek help when needed.
The Black Mirror star is the youngest person and first black woman to ever give the festival’s MacTaggart Lecture.
She referred to herself as a “misfit” and said no-one really understands what “diversity” means because it’s a “buzzword”.
Coel described a moment of “thoughtlessness” onset when a group of five black actors were made to share a trailer while a white actress had her own.
She recalled screaming at producers: “You know what this looks like don’t you?
“A slave ship!”
Coel warned such mistakes could be avoided if people were aware enough to spot them, adding that a lack of diversity from the top down means this doesn’t happen.
The writer also shared a story of when she and a co-star had rocks thrown at them in a racist attack while filming abroad.
She questioned if such traumas could be evaded if there was more diversity among executives who might think of filming in certain territories as a “low cost haven”.
Coel added: “They didn’t consider the experiences of the brown and black cast to meet the morals of their diversity compass, because they didn’t think to see things from our point of view.”
She also revealed that she had been racially abused at theatre school before she became a star.
Coel used her lecture to challenging the 1,500 strong audience of executives and producers to do more to “make misfits feel at home” in the TV industry.
She warned: “The lack of varied perspective among producers, the lack of misfits producing telly can have catastrophic consequences.”