Class Spreadsheet::Worksheet
In: lib/spreadsheet/excel.rb
lib/spreadsheet/worksheet.rb
Parent: Object

The Worksheet class. Contains most of the Spreadsheet data in Rows.

Interesting Attributes

name :The Name of this Worksheet.
default_format:The default format used for all cells in this Workhseet that have no format set explicitly or in Row#default_format.
rows :The Rows in this Worksheet. It is not recommended to Manipulate this Array directly. If you do, call updated_from with the smallest modified index.
columns :The Column formatting in this Worksheet. Column instances may appear at more than one position in columns. If you modify a Column directly, your changes will be reflected in all those positions.
selected :When a user chooses to print a Workbook, Excel will include all selected Worksheets. If no Worksheet is selected at Workbook#write, then the first Worksheet is selected by default.

Methods

Included Modules

Spreadsheet::Encodings Enumerable

External Aliases

format_column -> new_format_column

Attributes

columns  [R] 
merged_cells  [R] 
name  [RW] 
password_hash  [RW] 
rows  [R] 
selected  [RW] 
workbook  [RW] 

Public Class methods

Public Instance methods

Get the enriched value of the Cell at row, column. See also Worksheet#cell, Row#[].

Set the value of the Cell at row, column to value. See also Row#[]=.

Add a Format to the Workbook. If you use Row#set_format, you should not need to use this Method.

Get the enriched value of the Cell at row, column. See also Worksheet#[], Row#[].

Returns the Column at idx.

The number of columns in this Worksheet which contain data.

The default Format of this Worksheet, if you have set one. Returns the Workbook‘s default Format otherwise.

Set the default Format of this Worksheet.

Delete the Row at idx (0-based) from this Worksheet.

Dimensions:[ first used row, first unused row, first used column, first unused column ] ( First used means that all rows or columns before that are empty. First unused means that this and all following rows or columns are empty. )

If no argument is given, each iterates over all used Rows (from the first used Row until but omitting the first unused Row, see also dimensions).

If the argument skip is given, each iterates from that row until but omitting the first unused Row, effectively skipping the first skip Rows from the top of the Worksheet.

Sets the default Format of the column at idx.

idx may be an Integer, or an Enumerable that iterates over a number of Integers.

format is a Format, or nil if you want to remove the Formatting at idx

Returns an instance of Column if idx is an Integer, an Array of Columns otherwise.

Formats all Date, DateTime and Time cells with format or the default formats:

  • ‘DD.MM.YYYY’ for Date
  • ‘DD.MM.YYYY hh:mm:ss’ for DateTime and Time

Insert a Row at idx (0-based) containing cells

The last Row containing any data

The index of the last Row containing any data

Set worklist protection

Is the worksheet protected?

Replace the Row at idx with the following arguments. Like update_row, but truncates the Row if there are fewer arguments than Cells in the Row.

The Row at idx or a new Row.

The number of Rows in this Worksheet which contain data.

Tell Worksheet that the Row at idx has been updated and the dimensions need to be recalculated. You should not need to call this directly.

Updates the Row at idx with the following arguments.

Renumbers all Rows starting at idx and calls row_updated for each of them.

[Validate]