The woman went into the Garthdee branch of the supermarket in Aberdeen at about 02:30 on Thursday.
She wrote on a social media site: "I was awoken by a police officer in the fruit and veg aisle. I had sleepwalked the 1.5 miles from my house then gone to Asda to get a watermelon."
Police Scotland said the woman was safely escorted home.
The woman wrote: "Obviously I was very confused, only made worse by the fact that I was barefoot, in my nightdress and freezing cold.
"So, thanks to the very kind Asda staff who warmed me up and gave me shoes, socks and a cup of tea and to the lovely police officers who deposited my very confused self back in bed."
Police Scotland said: "Police in Aberdeen were called to reports of concern for a 23-year-old woman at Asda at Garthdee.
"Officers attended and assisted the woman home safely."
Robert Wallace, deputy store manager at the store, said: "We do our level best to create a relaxing shopping environment, so we're flattered that she chose our store to visit on her trip out.
"Our colleagues were quick to make sure that she was well looked after and we are glad that she got home safely for a good night's sleep."
A sleepwalker in her nightdress found looking for a watermelon in Asda had to be taken home by police.