Excel.WorksheetSingleClickedEventArgs interface
Provides information about the left-clicked/tapped event and its related worksheet.
Remarks
Properties
address | Gets the address that represents the cell which was left-clicked/tapped for a specific worksheet. |
offsetX | The distance, in points, from the left-clicked/tapped point to the left (or right for right-to-left languages) gridline edge of the left-clicked/tapped cell. |
offsetY | The distance, in points, from the left-clicked/tapped point to the top gridline edge of the left-clicked/tapped cell. |
type | Gets the type of the event. |
worksheet |
Gets the ID of the worksheet in which the cell was left-clicked/tapped. |
Property Details
address
Gets the address that represents the cell which was left-clicked/tapped for a specific worksheet.
address: string;
Property Value
string
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/event-worksheet-single-click.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getActiveWorksheet();
sheet.onSingleClicked.add((event) => {
return Excel.run((context) => {
console.log(`Click detected at ${event.address} (pixel offset from upper-left cell corner: ${event.offsetX}, ${event.offsetY})`);
return context.sync();
});
});
console.log("The worksheet click handler is registered.");
await context.sync();
});
offsetX
The distance, in points, from the left-clicked/tapped point to the left (or right for right-to-left languages) gridline edge of the left-clicked/tapped cell.
offsetX: number;
Property Value
number
Remarks
offsetY
The distance, in points, from the left-clicked/tapped point to the top gridline edge of the left-clicked/tapped cell.
offsetY: number;
Property Value
number
Remarks
type
Gets the type of the event.
type: "WorksheetSingleClicked";
Property Value
"WorksheetSingleClicked"
Remarks
worksheetId
Gets the ID of the worksheet in which the cell was left-clicked/tapped.
worksheetId: string;
Property Value
string
Remarks
Office Add-ins