Read Excel files from Rust
Clone or download
evanmiller Merge pull request #2 from brunoqc/patch-1
Highlight code in README.md
Latest commit 1eea2ab Aug 23, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Use new location of C types Aug 11, 2016
.gitignore First version May 9, 2015
Cargo.toml First version May 9, 2015
LICENSE Initial commit May 9, 2015
README.md Highlight code in README.md Aug 23, 2016

README.md

rust-xls

Read Excel files from Rust. Requires libxls.

Example program:

extern crate xls;

use std::env;

fn main() {
    let version = xls::reader::version();
    let arg_vec = env::args().collect::<Vec<String>>();
    if arg_vec.len() == 2 {
        println!("libxls version: {}", version);
        let maybe_handle = xls::reader::workbook::new(arg_vec[1].clone());
        match maybe_handle {
            Some(workbook) => {
                println!("Success!");
                for sheet in workbook.sheets() {
                    println!("+ Sheet");
                    for row in sheet.rows() {
                        println!("++ Row {}", row.index);
                        for cell in row.cells() {
                            match cell.value() {
                                Some(value) =>  {
                                    println!("+++ Cell {}: {}", cell.col_number,
                                             value);
                                },
                                None => { },
                            }
                        }
                    }
                }
            },
            None => println!("Failure!"),
        }
    } else {
        println!("Usage: {} <filename>", arg_vec[0]);
        std::process::exit(1);
    };
}