Camila Cabello has recently revealed how writing a Cinderella song helped her overcome her mental health struggles.

The 24-year-old three-time Grammy nominee revealed that while writing one of the songs for Cinderella, she was going through a “really hard time” with her mental health.

During a conversation with Kid Cudi, Anderson .Paak and the Sparks Brothers for The Hollywood Reporter’s Songwriter Roundtable, Cabello said, “I don’t think I know how to write in any way that isn’t personal to me. When I was working on ‘Million to One’ for Cinderella, to be totally honest, I was going through a really hard time with my mental health.”

“It was just a period of a lot of anxiety and sadness for me, and that song had me feeling like, ‘I can overcome this. I know that I can make my life better,’” she added. “I feel like I channeled my personal journey into one of the characters. The character was super confident — everybody was telling her no, but she knew.”

Previously, Cabello talked about her anxiety and stress while filming the movie musical, which was halted due to the COVID pandemic. During an Apple Fitness+ Time to Walk program, she revealed that she “would just break down crying once a day at least.”

In November, the Señorita singer said, “Before the pandemic, I felt really burnt out. I had been working pretty nonstop since I was 15. And the rigor with which I started working, there was just no time off.”

“I was barely home. I didn’t have time to get to know who I was outside of my career,” she continued. “Pile that onto struggles with mental health, with anxiety, with these toxic levels of stress, it wasn’t even a meltdown because I would just work through it.”

“I was just exhausted in every way and at that point, I felt like I was running a marathon with a broken leg,” Cabello added. “I kept going, but it was extremely hard. And I wish that I would’ve just been like, ‘Let me just stop for a second and get a nice cast for my broken leg and get some physical therapy.’ But I didn’t. COVID stepped in and kind of did it for me.”

In November, Cabello announced her split from boyfriend Shawn Mendes, who had been together for more than two years. They said in a joint statement, “Hey guys, we’ve decided to end our romantic relationship but our love for another as humans is stronger than ever.”