Sheet class Core

Represents a single worksheet within an Excel workbook.

Available extensions

Properties

autoFilter String?
The autofilter range as an A1:D1-style string, or null if none is set.
no setterinherited
autoFilterColumns List<FilterColumn>
The applied per-column filter FilterColumn criteria, or an empty list when the autofilter only shows dropdowns (or there is none).
no setterinherited
charts List<Chart>
The charts on this sheet, both those added via addChart and those read from an opened file. Read-only.
no setterinherited
columnPageBreaks List<int>
The manual column page breaks: 0-based indices of columns that start a new printed page, sorted ascending.
no setterinherited
comments Map<String, Comment>
The cell comments (notes) on this sheet, keyed by cell reference ("B2").
no setterinherited
conditionalFormats List<ConditionalFormat>
The conditional-formatting rules on this sheet, those read from an opened file first, then any added via the API, each carrying its ConditionalFormat.range. Read rules are for inspection; they round-trip untouched in the sheet envelope and are not re-emitted from this list.
no setterinherited
dataValidations Map<String, DataValidation>
All data validations on this sheet, keyed by their sqref range string (e.g. "C2:C100"). Read-only; edit via setDataValidation / removeDataValidation.
no setterinherited
defaultColumnWidth double?
The default column width, or null if not set.
no setterinherited
defaultRowHeight double?
The default row height, or null if not set.
no setterinherited
frozenColumns int
The number of leading columns currently frozen (0 if none).
no setterinherited
frozenRows int
The number of leading rows currently frozen (0 if none).
no setterinherited
getColumnAutoFits Map<int, bool>
returns map of auto fit columns
no setterinherited
getColumnWidths Map<int, double>
returns map of custom width columns
no setterinherited
getRowHeights Map<int, double>
returns map of custom height rows
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
headerFooter HeaderFooter?
The header and footer settings for this sheet.
getter/setter pairinherited
All hyperlinks on this sheet, keyed by their cell/range reference (e.g. "A1"). Read-only; use setHyperlink / removeHyperlink to edit.
no setterinherited
images List<ExcelImage>
All images on this sheet, in document order (those read from the file plus any inserted via insertImage). Read-only.
no setterinherited
isProtected bool
Whether this sheet is protected.
no setterinherited
isRTL bool
returns true is this sheet is right-to-left other-wise false
getter/setter pairinherited
maxColumns int
returns count of columns having data in sheet
no setterinherited
maxRows int
returns count of rows having data in sheet
no setterinherited
pageSetup PageSetup?
The page/print setup for this sheet (orientation, scaling, centering, what to print, and margins), or null if none is set.
getter/setter pairinherited
pivotTables List<PivotTable>
The pivot tables on this sheet, both those added via addPivotTable and those read from an opened file. Read-only.
no setterinherited
printArea String?
The print area as a cleaned A1:D10-style range (sheet qualifier and $ markers stripped; multiple areas comma-separated), or null if unset.
no setterinherited
printTitleColumns String?
The repeating title columns as a cleaned A:A-style range, or null.
no setterinherited
printTitleRows String?
The repeating title rows as a cleaned 1:1-style range, or null.
no setterinherited
protectionAllowed Set<SheetProtectionOption>
The actions permitted while this sheet is protected (read-only view).
no setterinherited
rowPageBreaks List<int>
The manual row page breaks: 0-based indices of rows that start a new printed page, sorted ascending.
no setterinherited
rows List<List<Data?>>
returns 2-D dynamic List of the sheet elements
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sheetName String
return SheetName
no setterinherited
showGridLines bool
Whether gridlines are shown in this sheet (default true).
getter/setter pairinherited
showRowColHeaders bool
Whether row and column headers are shown in this sheet (default true).
getter/setter pairinherited
spannedItems List<String>
returns List of Spanned Cells as
no setterinherited
sparklineGroups List<SparklineGroup>
The sparkline groups on this sheet, those read from an opened file first, then any added via the API. Read groups are for inspection; they round-trip untouched in the worksheet extLst.
no setterinherited
splitX int
The horizontal split position in twips (1/20 pt), or 0 when not split.
no setterinherited
splitY int
The vertical split position in twips (1/20 pt), or 0 when not split.
no setterinherited
tabColor ExcelColor?
The colour of this sheet's tab, or null if none is set.
getter/setter pairinherited
tables List<ExcelTable>
The Excel tables (ListObjects) on this sheet (read from the file plus any added via addTable). Read-only; edit via addTable / removeTable.
no setterinherited
visibility SheetVisibility
Whether this sheet's tab is visible, hidden, or very hidden.
getter/setter pairinherited
zoom int?
The zoom level as a percentage (Excel supports 10-400), or null for the default. Non-positive values are treated as unset.
getter/setter pairinherited

Methods

addChart(Chart chart) → void
Adds chart to the sheet. It is drawn through the sheet's drawing part on save, alongside any images or existing charts.
inherited
addConditionalFormat(CellIndex start, CellIndex end, ConditionalFormat format) → void
Adds a conditional-formatting format over the range from start to end. Multiple rules may target the same or overlapping ranges.
inherited
addPivotTable(PivotTable pivot) → void
Adds a PivotTable summarising a worksheet range.
inherited
addSparkline({required String location, required String dataRange, SparklineType type = SparklineType.line, ExcelColor? color}) → void
Convenience for a single sparkline: draws a type sparkline of dataRange in the cell location (both A1-style strings). For several sparklines sharing one style, prefer addSparklineGroup.
inherited
addSparklineGroup(SparklineGroup group) → void
Adds a SparklineGroup (a set of sparklines sharing one type and colour).
inherited
addTable(ExcelTable table) → void
Adds an Excel table (ListObject) over a cell range.
inherited
appendRow(List<CellValue?> row) → void
Appends row iterables just post the last filled rowIndex.
cell(CellIndex cellIndex) Data
returns the DataObject at position of cellIndex
inherited
clearPageBreaks() → void
Removes all manual page breaks from this sheet.
inherited
clearRow(int rowIndex) bool
returns true if the contents are successfully cleared else false.
columnOutlineLevel(int columnIndex) int
The outline (grouping) level of columnIndex, 0 when not grouped.
inherited
evaluate(CellIndex index) CellValue? Core
Evaluates the formula at index and returns the computed CellValue.
inherited
findAndReplace(Pattern source, String target, {int first = -1, int startingRow = -1, int endingRow = -1, int startingColumn = -1, int endingColumn = -1}) int
Returns the count of replaced source with target
freezePanes({int rows = 0, int columns = 0}) → void
Freezes the top rows rows and left columns columns so they stay in view while scrolling. Pass both as 0 (or call unfreezePanes) to clear.
inherited
getColumnAutoFit(int columnIndex) bool
returns auto fit state of column index
inherited
getColumnWidth(int columnIndex) double
returns width of column index
inherited
getComment(CellIndex index) Comment?
The comment on the cell at index, or null if there is none.
inherited
getDataValidation(CellIndex start, {CellIndex? end}) DataValidation?
Returns the data validation keyed to exactly the range from start to end (or the single cell start), or null if there is none.
inherited
Returns the hyperlink on the cell at cellIndex, or null if there is none keyed to that exact reference.
inherited
getRowHeight(int rowIndex) double
returns height of row index
inherited
getTable(String name) ExcelTable?
Returns the table named name (case-insensitive), or null if there is none.
inherited
groupColumns(int fromColumn, int toColumn, {bool collapsed = false}) → void
Groups columns fromColumn-toColumn (0-based, inclusive) into a collapsible outline. Each call nests one level deeper (max 7). When collapsed is true the columns are hidden and the summary column just to the right is flagged collapsed.
inherited
groupRows(int fromRow, int toRow, {bool collapsed = false}) → void
Groups rows fromRow-toRow (0-based, inclusive) into a collapsible outline. Each call nests one level deeper (Excel's "Group", max 7). When collapsed is true the rows are hidden and the summary row just below the group is flagged collapsed (Excel's default "summary below" layout).
inherited
insertColumn(int columnIndex) → void
Inserts an empty column in sheet at position = columnIndex.
inherited
insertColumnPageBreak(int columnIndex) → void
Inserts a manual page break to the left of columnIndex (0-based) so that column begins a new printed page. Indices <= 0 are ignored.
inherited
insertImage(List<int> bytes, {required CellIndex anchor, int? width, int? height}) → void
Inserts bytes as a picture with its top-left corner anchored at anchor.
inherited
insertRow(int rowIndex) → void
Inserts an empty row in sheet at position = rowIndex.
inherited
insertRowIterables(List<CellValue?> row, int rowIndex, {int startingColumn = 0, bool overwriteMergedCells = true}) → void
Inserts row values at rowIndex.
insertRowPageBreak(int rowIndex) → void
Inserts a manual page break above rowIndex (0-based) so that row begins a new printed page. Indices <= 0 are ignored; there is no page above the first row.
inherited
isColumnHidden(int columnIndex) bool
Whether columnIndex is hidden.
inherited
isRowHidden(int rowIndex) bool
Whether rowIndex is hidden.
inherited
merge(CellIndex start, CellIndex end, {CellValue? customValue}) → void
Merges the cells starting from start to end.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
protect({String? password, Set<SheetProtectionOption> allow = const {}}) → void
Protects the sheet, locking every action except selecting cells and any listed in allow.
inherited
removeAutoFilter() → void
Removes the autofilter from this sheet.
inherited
removeColumn(int columnIndex) → void
If sheet exists and columnIndex < maxColumns then it removes column at index = columnIndex
inherited
removeColumnPageBreak(int columnIndex) → void
Removes a previously inserted column page break (no-op if absent).
inherited
removeComment(CellIndex index) → void
Removes the comment from the cell at index (no-op if there is none).
inherited
removeDataValidation(CellIndex start, {CellIndex? end}) DataValidation?
Removes and returns the data validation keyed to exactly the range from start to end (or the single cell start).
inherited
Removes and returns any hyperlink on the cell at cellIndex.
inherited
removePrintArea() → void
Removes the print area (no-op if none is set).
inherited
removePrintTitles() → void
Removes the repeating print titles (no-op if none are set).
inherited
removeRow(int rowIndex) → void
If sheet exists and rowIndex < maxRows then it removes row at index = rowIndex
inherited
removeRowPageBreak(int rowIndex) → void
Removes a previously inserted row page break (no-op if absent).
inherited
removeTable(String name) bool
Removes the table named name (case-insensitive). Returns true if a table was removed.
inherited
row(int rowIndex) List<Data?>
returns row at index = rowIndex
inherited
rowOutlineLevel(int rowIndex) int
The outline (grouping) level of rowIndex, 0 when not grouped, up to 7.
inherited
selectRange(CellIndex start, {CellIndex? end}) List<List<Data?>?>
returns 2-D dynamic List of the sheet cell data in that range.
selectRangeValues(CellIndex start, {CellIndex? end}) List<List?>
returns 2-D dynamic List of the sheet elements in that range.
selectRangeValuesWithString(String range) List<List?>
returns 2-D dynamic List of the sheet elements in that range.
selectRangeWithString(String range) List<List<Data?>?>
returns 2-D dynamic List of the sheet cell data in that range.
setAutoFilter(CellIndex from, CellIndex to, {List<FilterColumn>? criteria}) → void
Adds filter dropdowns over the header range from from to to (e.g. the header row of a table). Replaces any existing autofilter.
inherited
setColumnAutoFit(int columnIndex) → void
Set Column AutoFit
inherited
setColumnHidden(int columnIndex, bool hidden) → void
Shows or hides columnIndex.
inherited
setColumnWidth(int columnIndex, double columnWidth) → void
Set Column Width
inherited
setComment(CellIndex index, Comment comment) → void
Attaches comment to the cell at index, replacing any existing one.
inherited
setDataValidation(CellIndex start, DataValidation validation, {CellIndex? end}) → void
Applies validation to the range from start to end (or just the single cell start when end is omitted).
inherited
setDefaultColumnWidth([double columnWidth = _excelDefaultColumnWidth]) → void
Set the default column width.
inherited
setDefaultRowHeight([double rowHeight = _excelDefaultRowHeight]) → void
Set the default row height.
inherited
Attaches link to the cell at cellIndex.
inherited
setMergedCellStyle(CellIndex start, CellStyle mergedCellStyle) → void
Sets the cellStyle of the merged cells.
inherited
setPrintArea(CellIndex from, CellIndex to) → void
Restricts printing to the rectangle from from to to. Stored as the built-in _xlnm.Print_Area defined name scoped to this sheet.
inherited
setPrintTitleColumns(int fromColumn, int toColumn) → void
Repeats columns fromColumn-toColumn (0-based, inclusive) at the left of every printed page. Preserves any repeating rows already set.
inherited
setPrintTitleRows(int fromRow, int toRow) → void
Repeats rows fromRow-toRow (0-based, inclusive) at the top of every printed page. Preserves any repeating columns already set.
inherited
setRowHeight(int rowIndex, double rowHeight) → void
Set Row Height
inherited
setRowHidden(int rowIndex, bool hidden) → void
Shows or hides rowIndex.
inherited
splitPanes({int xSplit = 0, int ySplit = 0, String? topLeftCell}) → void
Splits the sheet into independently-scrolling panes at xSplit twips from the left and/or ySplit twips from the top (1 twip = 1/20 pt). Unlike freezePanes, split panes are draggable and scroll independently.
inherited
toCsv({CsvConfig? config, bool formulasAsText = false}) String

Available on Sheet, provided by the SheetCsv extension

Serialises this sheet's used cell range to CSV text.
toString() String
A string representation of this object.
inherited
unfreezePanes() → void
Removes any frozen or split panes from this sheet.
inherited
ungroupColumns(int fromColumn, int toColumn) → void
Removes one outline level from columns fromColumn-toColumn and un-hides them.
inherited
ungroupRows(int fromRow, int toRow) → void
Removes one outline level from rows fromRow-toRow and un-hides them.
inherited
unMerge(String unmergeCells) → void
unMerge the merged cells.
inherited
unprotect() → void
Removes protection from this sheet.
inherited
updateCell(CellIndex cellIndex, CellValue? value, {CellStyle? cellStyle}) → void
Updates the contents of sheet of the cellIndex: CellIndex.indexByColumnRow(0, 0); where indexing starts from 0

Operators

operator ==(Object other) bool
The equality operator.
inherited