A new study on insomnia in postmenopausal women suggests that consuming refined carbohydrates may keep you awake. The findings were published online in The American Journal of Clinical Nutrition.

Investigators analyzed food diaries from more than 50,000 participants in the Women’s Health Initiative and looked at whether women with a higher dietary glycemic index were more likely to develop insomnia.

Previously, researchers have been unable to confirm whether refined carbs trigger insomnia or whether insomnia causes individuals to eat more sweets. In this study, investigators sought to determine the role of carbs in creating sleep problems by looking for the emergence of insomnia across different types of diet.

The link they discovered between high glycemic diets and insomnia can be attributed to the quick spike in blood sugar after eating highly refined carbohydrates, like added sugars, white bread, white rice and soda. An increase in blood sugar causes the body to release insulin and other hormones—such as adrenaline and cortisol—that interfere with sleep.

The study also found that women whose diets contained higher amounts of vegetables, fiber and whole fruits were less likely to develop insomnia.

“Whole fruits contain sugar, but the fiber in them slows the rate of absorption to help prevent spikes in blood sugar,” said the study’s senior author, James Gangwisch, PhD, assistant professor of clinical psychiatric social work at Columbia University Vagelos College of Physicians and Surgeons, in a ScienceDaily press release “This suggests that the dietary culprit triggering the women’s insomnia was the highly processed foods that contain larger amounts of refined sugars that aren’t found naturally in food.”

While the research focuses primarily on postmenopausal women, the effects of carbs on blood sugar are true for most people and suggest the study has broader applications.

“Based on our findings, we would need randomized clinical trials to determine if a dietary intervention, focused on increasing the consumption of whole foods and complex carbohydrates, could be used to prevent and treat insomnia,” said Gangwisch.