Single sign-on (SSO) was released in developer preview last week. As part of the system, your add-in gets a token from the Office host application that contains a "preferred_username" property. The value of the property is the email of the user logged into Office.
There is an overview at Enable single sign-on for Office add-ins (preview).
There are two samples:
Office-Add-in-ASPNET-SSO
Office-Add-in-Nodejs-SSO
In both samples, the add-in also uses the token received from Office host to get an access token to Microsoft Graph, but your add-in doesn't have to take that extra step.
I don't know of any way of getting the user identity without using SSO.
Office.context.document.url
in Excel. – cs_pupil