Git Product home page Git Product logo

excellent's Introduction

Excellent

Build Status Coverage Status hex.pm version

DISCLAIMER: Completely abandoned. No further development will take place. If you're looking for an xlxs parsing library, consider using xlsxir

This is a library for parsing .xlsx files (Open XML format). It is targeted for reading Excel 2000 files into a list of lists.

Sample output:

[
  ["A1", "B1", "C1", "D1"],
  ["A2", "B2", "C2", "D2"],
  ["A3", "B3", "C3", "D3"],
  ["A4", "B4", "C4", "D4"],
  ["A5", "B5", "C5", "D5"],
]

Installation

You can add Excellent as a dependency in your mix.exs file. Since it only requires Elixir and Erlang there are no other dependencies.

def deps do
  [ { :excellent, "~> 0.0.1" } ]
end

If you aren't using hex, add the a reference to the github repo.

def deps do
  [ { :excellent, github: "leifg/excellent" } ]
end

Then run mix deps.get in the shell to fetch and compile the dependencies

Usage

The top level funtion takes 2 arguments: the filename and the number of the worksheet you want to parse (zero based).

Excellent.parse('spreadsheet.xlsx', 0)

=> [
  ["A1", "B1", "C1", "D1"],
  ["A2", "B2", "C2", "D2"],
  ["A3", "B3", "C3", "D3"],
  ["A4", "B4", "C4", "D4"],
  ["A5", "B5", "C5", "D5"],
]

There is also a function to return the names of the worksheets as a tuple:

Excellent.worksheet_names('spreadsheet.xlsx')

=> {"Worksheet 1", "Worksheet 2"}

TODO

  • Read worksheets as stream from ZIP archive
  • Implement different data types (curently only strings and numbers are supported)

excellent's People

Contributors

leifg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

excellent's Issues

Export Excel files?

Do you have any plans to add an export feature to generate and write Excel files?

No match of right hand value error

Excellent.parse('./test.xlsx', 0)
** (MatchError) no match of right hand side value: {:error, :enoent}
    lib/excellent.ex:27: Excellent.file_content/2
    lib/excellent.ex:7: Excellent.parse/2

When use Excellent.parse, (MatchError) no match of right hand side value

iex(2)> Excellent.parse("test_spreadsheet.xlsx", 0)
** (MatchError) no match of right hand side value: {:error, {:EXIT, {{:badmatch, "test_spreadsheet.xlsx"}, [{:zip, :binary_io, 2, [file: 'zip.erl', line: 1724]}, {:zip, :get_end_of_central_dir, 3, [file: 'zip.erl', line: 1313]}, {:zip, :get_central_dir, 3, [file: 'zip.erl', line: 1269]}, {:zip, :do_unzip, 2, [file: 'zip.erl', line: 380]}, {:zip, :unzip, 2, [file: 'zip.erl', line: 370]}, {Excellent, :file_content, 2, [file: 'lib/excellent.ex', line: 57]}, {Excellent, :parse, 2, [file: 'lib/excellent.ex', line: 12]}, {:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 669]}, {:elixir, :erl_eval, 3, [file: 'src/elixir.erl', line: 196]}, {:elixir, :eval_forms, 4, [file: 'src/elixir.erl', line: 184]}, {IEx.Evaluator, :handle_eval, 5, [file: 'lib/iex/evaluator.ex', line: 117]}, {IEx.Evaluator, :do_eval, 3, [file: 'lib/iex/evaluator.ex', line: 110]}, {IEx.Evaluator, :eval, 3, [file: 'lib/iex/evaluator.ex', line: 90]}, {IEx.Evaluator, :loop, 2, [file: 'lib/iex/evaluator.ex', line: 27]}, {IEx.Evaluator, :start, 2, [file: 'lib/iex/evaluator.ex', line: 18]}]}}}
lib/excellent.ex:57: Excellent.file_content/2
lib/excellent.ex:12: Excellent.parse/2

Compilation error

 == Compilation error on file lib/excellent/parser.ex ==
** (RuntimeError) error parsing file /usr/lib/erlang/lib/xmerl-1.3.8/include/xmerl.hrl, got: {:error, :enoent}
    (elixir) lib/record/extractor.ex:80: Record.Extractor.read_file/1
    (elixir) lib/record/extractor.ex:50: Record.Extractor.extract_record/2
    lib/excellent/parser.ex:4: (module)
    (stdlib) erl_eval.erl:669: :erl_eval.do_apply/6

could not compile dependency :excellent, "mix compile" failed. You can recompile this dependency with "mix deps.compile 
excellent", update it with "mix deps.update excellent" or clean it with "mix deps.clean excellent"            

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.