Metformin...

Im 35 weeks and have gestational diabetes. My fasting number are over the normal range. I was prescribe Metformin and I don't know what to do. Is it safe at all? I really didn't want to take any medication at all for this pregnancy