You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/Excel/Spreadsheet/Blazor/worksheet.md
+63-9Lines changed: 63 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,15 +72,19 @@ This method inserts one or more sheets at a specified position in the workbook w
72
72
{% endtabs %}
73
73
74
74
75
-
### Get active worksheet
75
+
### Get Active Worksheet Programmatically
76
76
77
-
Retrieves key properties of the [GetActiveWorksheet](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetActiveWorksheet), including name, index, row and column counts, the active cell, and the current selection. Returns null when no active worksheet is available.
77
+
Use the [GetActiveWorksheet](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetActiveWorksheet) method to retrieve the currently active worksheet in the Spreadsheet component. This is particularly useful to perform operations relative to the current sheet selection. The method returns key properties of the active worksheet, such as its name, index, size (row and column counts), current active cell, and selected range. Returns null if no active worksheet is available.
78
+
79
+
**Retrieve the active worksheet**
80
+
81
+
This approach fetches the worksheet that is currently active (selected), enabling access to its properties or performing operations programmatically (for example, reading its name or ID, or using it as a context for further actions).
78
82
79
83
{% tabs %}
80
84
{% highlight razor %}
85
+
@using Syncfusion.Blazor.Spreadsheet
81
86
82
87
<button @onclick="GetActiveWorksheet">Get Active Worksheet</button>
@@ -101,23 +105,29 @@ Retrieves key properties of the [GetActiveWorksheet](https://help.syncfusion.co
101
105
var active = SpreadsheetInstance.GetActiveWorksheet();
102
106
}
103
107
}
104
-
105
108
{% endhighlight %}
106
109
{% endtabs %}
107
110
108
-
### Get cell or range data
109
111
110
-
Retrieves key properties of the [GetData](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetData_System_String_), for a single cell or a selected range and returns a map keyed by each cell's address. Each value is a `CellData` built from the corresponding worksheet cell, including value, number format, formatted display text (when a format is applied), wrap state, lock state, optional hyperlink, and computed style. Returns null when the provided address is null or whitespace.
112
+
113
+
### Get Worksheet Data Programmatically
114
+
115
+
Use the [GetData](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetData_System_String_) method to retrieve data from a worksheet, either from a single cell or a specified range. This API returns key information about each cell in the given address, making it ideal for extracting and processing spreadsheet data programmatically.
116
+
117
+
**Retrieve cell or range data from an active worksheet**
118
+
119
+
This method returns a dictionary where each key is a cell's address and its value is a `CellData` object. The returned data includes the raw value, number format, display text (with formatting, if any), wrap/lock status, hyperlink (if applicable), and calculated style. If no cell address is given, or if it is invalid, the result will be null.
111
120
112
121
| Parameter | Type | Description |
113
-
| -- | -- | -- |
114
-
| cellAddress | string |Specifies the cell or range to read. Supports A1 addresses (for example, "A1"), ranges (for example, "A2:B5"), or sheet-qualified references (for example, "Sheet1!A1" or "Sheet1!A2:B5"). When a sheet name is specified, data is read from that sheet; otherwise, the active sheet is used. Null or whitespace results in no data being returned. |
122
+
|:-- |:-- |:-- |
123
+
| cellAddress | string |The address of the cell or range to read. Can use simple A1 (e.g., "A1"), range (e.g., "A2:B5"), or a sheet-qualified reference (e.g., "Sheet1!A2:B5"). If omitted or invalid, returns null. |
@@ -138,6 +148,50 @@ Retrieves key properties of the [GetData](https://help.syncfusion.com/cr/blazor
138
148
var data = SpreadsheetInstance.GetData("Sheet2!D5:E6");
139
149
}
140
150
}
151
+
{% endhighlight %}
152
+
{% endtabs %}
153
+
154
+
155
+
156
+
**Get cell or range data**
157
+
158
+
This method retrieves data for a single cell or a selected range, returning a dictionary where each key is a cell's address and each value is a `CellData` object. This object contains important cell properties like its raw value, number format, formatted display text (if a format is applied), wrap text status, locked status, any hyperlinks (if applicable and not a formula), and computed style. If the `cellAddress` is null or contains only whitespace, this method returns null.
159
+
160
+
| Parameter | Type | Description |
161
+
| :-- | :-- | :-- |
162
+
| cellAddress | string | Specifies the cell or range to read. Supports A1 addresses (for example, "A1"), ranges (for example, "A2:B5"), or sheet-qualified references (for example, "Sheet1!A1" or "Sheet1!A2:B5"). If a sheet name is specified, data is read from that sheet; otherwise, the active sheet is used. Null or whitespace results in no data being returned. |
0 commit comments