Expand description
The Worksheet is the primary object in this module since this is where most of the valuable data is. See the methods below for how to use.
Fields
name: String
position: u8
Implementations
sourceimpl Worksheet
impl Worksheet
sourcepub fn new(
relationship_id: String,
name: String,
position: u8,
target: String,
sheet_id: u8
) -> Self
pub fn new(
relationship_id: String,
name: String,
position: u8,
target: String,
sheet_id: u8
) -> Self
Create a new worksheet. Note that this method will probably not be called directly.
Instead, you’ll normally get a worksheet from a Workbook
object. E.g.,:
use xl::{Workbook, Worksheet};
let mut wb = Workbook::open("tests/data/Book1.xlsx").unwrap();
let sheets = wb.sheets();
let ws = sheets.get("Time");
assert!(ws.is_some());
sourcepub fn rows<'a>(&self, workbook: &'a mut Workbook) -> RowIter<'a>
pub fn rows<'a>(&self, workbook: &'a mut Workbook) -> RowIter<'a>
Obtain a RowIter
for this worksheet (that is in workbook
). This is, arguably, the main
part of the library. You use this method to iterate through all the values in this sheet.
The simplest thing you can do is print the values out (which is what xlcat
does), but you
could do more if you wanted.
Example usage
use xl::{Workbook, Worksheet, ExcelValue};
let mut wb = Workbook::open("tests/data/Book1.xlsx").unwrap();
let sheets = wb.sheets();
let ws = sheets.get("Sheet1").unwrap();
let mut rows = ws.rows(&mut wb);
let row1 = rows.next().unwrap();
assert_eq!(row1[0].raw_value, "1");
assert_eq!(row1[1].value, ExcelValue::Number(2f64));
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Worksheet
impl Send for Worksheet
impl Sync for Worksheet
impl Unpin for Worksheet
impl UnwindSafe for Worksheet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more