If you’re moving just one individual mail account from Gmail to Outlook online (part of Microsoft Office365) then using connected accounts should work but personally I could not get Outlook online to connect to my Gmail account.
It has been suggested that this was because I didn’t have two-factor authentication turned on at Gmail and therefore wasn’t using an application-specific password for the connection from Outlook. Not sure if this is correct or not.
After a number of dead ends, I found these instructions from migrating from Gmail to Office365 and although they involve more steps than just setting up a connected account, they did work seamlessly. The only caveat is that you need an Outlook client to make the magic happen.
Good luck!