The timeframe will depend on a few factors:
Depending on which method of surgery (i.e., invasiveness of the surgery) you may need longer to rest and heal.
It can also depend on your job role - it may take less time to return to work if you are desk-based, and may take more time to return to work if your job is manual and requires more physical effort. As well as speaking to your doctor, it may be helpful to speak to your HR department if you feel a phased return to work would be useful to you.
Your rights for leave can also vary from country to country. For example, in the UK, 6 weeks is the average time granted for time off work to recover from a hysterectomy/THBO, and in the U.S., FMLA leave can be used (up to 12 weeks per year) as needed before you are able to return to work. If you did not have a hysterectomy in addition to your ovary removal, you may find you need less time to recover.
Rest as much as possible during this time and do not lift anything heavy, such as bags of shopping. You need time for your abdominal muscles and internal tissues to heal.
Visit www.iapmd.org/surgery for lots of evidence-based information and resources for those considering, going through or recovering from surgery for PMDD/PME.