1. Log in to your Google account: https://myaccount.google.com/
2. Go to your account security settings: https://myaccount.google.com/security
3. In Connected apps & sites, set Allow less secure apps to ON.
4. Now, go to your mail account settings, Forwarding and POP/IMAP tab: https://mail.google.com/mail/u/0/#settings/fwdandpop
5. Under IMAP Access, confirm the following:
1. Select the radio button to Enable IMAP.
2. Under Folder Size Limits, set the radio button to Do not limit.
3. Click Save Changes.
6. Go to Labels tab and make sure Show in IMAP is checked beside all the labels. If this is not checked, that label (folder) may not migrate to Office365 at all.