Radoslaw Poprawski
Active Member
- Joined
- Jun 19, 2021
- Messages
- 398
- Office Version
- 365
- Platform
- Windows
so hello,
I am using beta M365 Excel and I am working on some sort smart solution for some.
What would be great is to get Python code that generates path to a desktop ( or at least Windows username )
My problem is that I tried:
and also a defined function:
however it does not work with =PY() excel function.
any idea how can get Desktop path (or windows username at least) with python code?
I am using beta M365 Excel and I am working on some sort smart solution for some.
What would be great is to get Python code that generates path to a desktop ( or at least Windows username )
My problem is that I tried:
Python:
# importing os module
import os
# using getlogin() returning username
os.getlogin()
and also a defined function:
Python:
import os
def get_username_os():
return os.getenv("USERNAME")
username = get_username_os()
print(f"Current username: {username}")
however it does not work with =PY() excel function.
any idea how can get Desktop path (or windows username at least) with python code?