Others

How to Retrieve the Logged-In User in Excel Online with JavaScript

Tauseeq MagsiTauseeq Magsi Oct 26, 2026 869 views

Question details

The user needs to retrieve the signed-in user's information and insert the current date into specific worksheet cells using JavaScript in Excel Online.

How to Retrieve the Logged-In User in Excel Online with JavaScript
Product
Excel Online
Device & OS
not provided
Scenario
Developing custom scripts to automate user tracking and date insertion within a cloud-based spreadsheet.
Observed behavior
The request requires specialized JavaScript or Office Scripts development expertise that falls outside the scope of general installation and activation support forums.
Before you start

Before writing your script, determine whether you are using the Office JavaScript API for an Add-in or Office Scripts (TypeScript), and ensure your Microsoft 365 admin has enabled script execution permissions.

Solution 1Recommended

Seek Expert Developer Support on Microsoft Q&A

Because custom JavaScript and Office Scripts development is highly specific, posting your exact requirements in specialized developer forums is the best way to get functional code snippets.

General Microsoft 365 support forums typically handle installation and activation issues. For complex automation logic, engaging with the developer community ensures you receive accurate, context-aware API guidance.

1
Navigate to Microsoft Q&A

Open your web browser and go to the official Microsoft Q&A developer platform.

2
Draft a Detailed Question

Create a new post detailing your intended Excel Online environment and specify the exact script type you are attempting to use (e.g., Office Web Add-in API or Office Scripts).

3
Provide Worksheet Variables

Include the specific worksheet cell addresses where the user details and the current date need to be inserted.

4
Specify the Date Format

Clearly state the required date format (such as MM/DD/YYYY or DD-MM-YYYY) so community experts can format the JavaScript `Date()` output correctly.

Seek Expert Developer Support on Microsoft Q&A
Important Context: Always mention if you are strictly limited to Excel Online, as some older COM Add-in or VBA solutions will not work in the cloud environment.
Advanced JS Macros in WPS Office

Automate Worksheets Easily Using JavaScript Macros in WPS Office

If you prefer to automate spreadsheets using JavaScript without the complex cloud deployment requirements of Excel Online Add-ins, WPS Office features a native, built-in JavaScript Macro (JSA) editor right on your desktop.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open a new or existing spreadsheet document.
  2. 2. Access the Macro Editor: Navigate to the 'Tools' tab on the top ribbon and click the 'Macro' button.
  3. 3. Launch WPS Macro Editor: Select 'WPS Macro Editor' from the dropdown menu to open the dedicated JavaScript development environment.
  4. 4. Write Your JavaScript Automation: Write your JS code using the `Date()` object and assign it to a worksheet cell, for example: `Range("A1").Value2 = new Date();`.
  5. 5. Run Your Script: Click the run button in the editor to instantly execute your JavaScript automation on your local spreadsheet.
Native JavaScript Macro (JSA) editor built directly into the applicationSeamless format compatibility with Microsoft Excel (.xlsx, .xlsm)Execute scripts locally without requiring complex Microsoft 365 admin permissionsLightweight desktop client that is completely free to use
microsoft office alternative - wps office

Frequently Asked Questions

Can I use standard web JavaScript to automate Excel Online?

Not directly. Automating Excel Online requires either Office Scripts (which uses TypeScript) or the specialized Office JavaScript API for Web Add-ins. Standard DOM-based web JavaScript will not interact with the spreadsheet grid.

How do I insert the current date in an online spreadsheet without code?

You can use the built-in spreadsheet functions `=TODAY()` for the current date or `=NOW()` for the current date and time. Alternatively, you can use the keyboard shortcut 'Ctrl + ;' to insert a static current date.

Does WPS Office support JavaScript for spreadsheet automation?

Yes, WPS Office has native support for JavaScript Macros (JSA). This allows developers to write automation scripts using standard JavaScript syntax directly within the desktop application, serving as a modern alternative to traditional VBA.

Where is the best place to ask advanced Microsoft Office API questions?

For highly technical API queries, Office Scripts, and Add-in development, the official Microsoft Q&A developer forums or Stack Overflow are the best platforms to get specialized, code-level support.