The Worksheet class represents a worksheet in the workbook.
the recommended way to manage worksheets is Workbook#add_worksheet
Creates a new worksheet.
Returns the cell or cells defined using excel style A1:B3 references.
each chart type also specifies additional options
Adds a chart to this worksheets drawing. This is the recommended way to create charts for your worksheet. This method wraps the complexity of dealing with ooxml drawing, anchors, markers graphic frames chart objects and all the other dirty details.
Shortcut to worsksheet_comments#add_comment
Add conditional formatting to this worksheet.
Add data validation to this worksheet.
Adds a new hyperlink to the worksheet
Adds a media item to the worksheets drawing
Adds a page break (row break) to the worksheet should be added to the sheet.
Adds a row to the worksheet and updates auto fit data.
A range that excel will apply an auto-filter to “A1:B3” This will turn filtering on for the cells in the range. The first row is considered the header, while subsequent rows are considered to be data.
The auto filter range for the worksheet
convinience method to access all cells in this worksheet
Please do not use this directly. Instead use
A collection of column breaks added to this worksheet add_page_break
You can also specify the style for specific columns in the call to add_row by using an array for the :styles option
Set the style for cells in a specific column
returns the sheet data as columns If you pass a block, it will be evaluated whenever a row does not have a cell at a specific index. The block will be called with the row and column index in the missing cell was found.
Column info for the sheet
For updating only a single column it is probably easier to just set the width of the ws.column_info.width directly
This is a helper method that Lets you specify a fixed width for multiple columns in a worksheet in one go. Note that you must call column_widths AFTER adding data, otherwise the width will not be set successfully. Setting a fixed column width to nil will revert the behaviour back to calculating the width for you on the next call to add_row.
The a shortcut to the worksheet_comments list of comments
data validations array
The dimensions of a worksheet. This is not actually a required element by the spec, but at least a few other document readers expect this for conversion
the recommended way to work with drawings and charts is Worksheet#add_chart
The drawing associated with this worksheet.
Indicates if the worksheet will be fit by witdh or height to a specific number of pages. To alter the width or height for page fitting, please use page_setup.fit_to_widht or page_setup.fit_to_height. If you want the worksheet to fit on more pages (e.g. 2x2), set PageSetup#fit_to_width and PageSetup#fit_to_height accordingly.
Options for headers and footers.
A typed collection of hyperlinks associated with this worksheet
The index of this worksheet in the owning Workbook's worksheets list.
Initalizes page margin, setup and print options
Creates merge information for this worksheet. Cells can be merged by calling the merge_cells method on a worksheet.
merged cells array
The name of the worksheet
The name of the worksheet The name of a worksheet must be unique in the workbook, and must not exceed 31 characters
returns the column and row index for a named based cell
shortcut level to specify the outline level for a series of columns Oulining is what lets you add collapse and expand to a data set.
shortcut level to specify the outline level for a series of rows Oulining is what lets you add collapse and expand to a data set.
Page margins for printing the worksheet.
Page setup settings for printing the worksheet.
The pivot tables in this worksheet
The part name of this worksheet
Accessor for controlling whether leading and trailing spaces in cells are preserved or ignored. The default is to preserve spaces.
Options for printing the worksheet.
When using an array of cells, a contiguous range is created from the minimum top left to the maximum top bottom of the cells provided.
Adds a new protected cell range to the worksheet. Note that protected ranges are only in effect when sheet protection is enabled.
The recommended way to manage protected ranges is with Worksheet#protect_range
A collection of protected ranges in the worksheet
The worksheet relationships. This is managed automatically by the worksheet
The relationship part name of this worksheet
The relationship id of this worksheet.
Please do not use this directly. Instead use
A collection of row breaks added to this worksheet add_page_break
You can also specify the style in the add_row call
Set the style for cells in a specific row
The recommended way to manage rows is Worksheet#add_row
The rows in this worksheet
Use SheetView#tab_selected instead.
Indicates if the worksheet is selected in the workbook It is possible to have more than one worksheet selected, however it might cause issues in some older versions of excel when using copy and paste.
Use SheetView#tab_selected= instead.
The sheet calculation properties
The sheet format pr for this worksheet
The sheet properties for this workbook. Currently only pageSetUpPr -> fitToPage is implemented
The sheet protection object for this workbook
The sheet view object for this worksheet
Use SheetView#show_grid_lines instead.
Indicates if the worksheet should show gridlines or not
Use SheetView#show_grid_lines= instead.
Indicates if gridlines should be shown in the sheet. This is true by default.
The visibility of this sheet
Specifies the visible state of this sheet. Allowed states are :visible, :hidden or :very_hidden. The default value is :visible.
Worksheets in the :hidden state can be shown using the sheet formatting properties in excel. :very_hidden sheets should be inaccessible to end users.
shortcut method to access styles direclty from the worksheet This lets us do stuff like:
The tables in this worksheet
Returns a sheet node serialization for this sheet in the workbook.
Serializes the worksheet object to an xml string This intentionally does not use nokogiri for performance reasons
The workbook that owns this worksheet
The comments associated with this worksheet
Helper method for parsingout the root node for worksheet