Others

How to Get Signed-In User and Date with Excel Online JavaScript

Amos GikundaAmos Gikunda Oct 26, 2026 869 views

Question details

The user wants to write Office.js or Office Scripts code in Excel Online to retrieve the currently signed-in user's details and today's date (in DD-Month-YYYY format), and output these values into specific Excel cells.

How to Get the Signed-In User and Date Using Excel Online JavaScript
Product
Excel Online
Device & OS
not provided
Scenario
Automating spreadsheet tasks to track user activity and timestamps directly within Excel Online using JavaScript-based scripts.
Observed behavior
The user needs to locate the appropriate developer support communities or exact code implementation to handle user session data and date formatting in Excel automation.
Before you start

Verify whether your project uses Office Add-ins (Office.js) or Excel Office Scripts, as the execution environment, capabilities, and syntax differ significantly between the two.

Solution 1Recommended

Post Your Query to the Microsoft Q&A Community

Since retrieving user session data and writing custom TypeScript/JavaScript involves specific developer environments, the official Microsoft Q&A community is the recommended place to get tailored code solutions.

Office Scripts and Office.js handle user identity differently due to security and privacy restrictions. Often, you cannot retrieve the signed-in user directly through basic Office Scripts without utilizing Power Automate as an intermediary.

1
Navigate to Microsoft Q&A

Open your web browser and go to the official Microsoft Q&A website, which is the dedicated platform for developer and automation questions.

2
Select the Appropriate Tags

When creating a new question, make sure to include either the 'Office JavaScript' or 'Excel Office Scripts' tags so the correct experts see your post.

3
Provide Script Specifics

In your question, explicitly state whether you are using Office.js or Excel Office Scripts. Include the target worksheet name and the exact cell ranges where you want the user name and DD-Month-YYYY date to be printed.

Post Your Query to the Microsoft Q&A Community
Free Microsoft Office alternative

Experience Powerful Spreadsheet Automation with WPS Office

If you are exploring spreadsheet automation, WPS Office provides an incredibly lightweight, free, and highly compatible alternative to Microsoft Office. It features robust built-in JS Macro support, allowing you to easily automate your daily data processing tasks locally without complex cloud configurations.

  1. 1. Download and Install WPS Office: Visit the official WPS website to download and install the free WPS Office suite on your device.
  2. 2. Open WPS Spreadsheet: Launch WPS Office and open your existing .xlsx or .xls files seamlessly.
  3. 3. Explore JS Macros: Navigate to the Developer tab to start writing and executing JS Macros for your automation tasks.
Completely free and lightweight office suiteExcellent compatibility with Microsoft Excel (.xlsx, .xls) and macro formatsBuilt-in JS Macro support for automating complex spreadsheet calculationsFamiliar user interface ensuring a seamless migration process
microsoft office alternative - wps office

Frequently Asked Questions

What is the difference between Office.js and Excel Office Scripts?

Office.js is an API library used by developers to create full-featured Office Add-ins with customized UI panes. Excel Office Scripts is a simpler automation tool based on TypeScript/JavaScript designed for end-users to automate repetitive tasks directly within an Excel workbook on the web.

Can I natively fetch the logged-in user's email using Office Scripts?

No. Due to privacy and security policies, Excel Office Scripts does not provide a native method to retrieve the identity, name, or email of the user running the script. You must use Power Automate to capture this information and pass it into the script as a parameter.

How do I format the date to DD-Month-YYYY in JavaScript?

You can use standard JavaScript Date methods. For example, you can extract the day, map the month index to an array of month names (e.g., ['January', 'February'...]), and extract the full year, then combine them using template literals: `${day}-${monthName}-${year}`.

Does WPS Office support JavaScript automation?

Yes, WPS Office provides built-in support for JS Macros (WPS Macro). This feature allows users to utilize JavaScript to write custom automation scripts for their spreadsheets, serving as a modern alternative to traditional VBA.