Power Query get current USERNAME via NTFS route
✓ Published0🌍 Public
HHugoberry
Last edited Apr 2, 2017
Created on Apr 2, 2017
This example obtains the current Windows username by querying the file system rather than using environment variables. The Power Query M script lists the contents of the `C:\Users` directory with `Folder.Contents`, sorts the resulting table by the `Date accessed` column in descending order, and then selects the name of the first row. This assumes the current user is the one whose profile folder was accessed most recently, providing a NTFS-metadata-based fallback for identity detection.
AI-generated description