• Stars
    star
    224
  • Rank 177,792 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 13 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Roughly translate some Excel spreadsheets to Ruby or C.

Excel to Code

Tests Passing

excel_to_c - roughly translate some Excel files into C.

excel_to_ruby - roughly translate some Excel files into Ruby.

This allows spreadsheets to be:

  1. Embedded in other programs, such as web servers, or optimisers
  2. Without depending on any Microsoft code

For example, running these commands turns this spreadsheet into this Ruby code or this C code.

Install

Requires Ruby. Install by:

gem install excel_to_code

Run

To just have a go:

excel_to_c <excel_file_name>

This will produce a file called excelspreadsheet.c

For a more complex spreadsheet:

excel_to_c --compile --run-tests --settable <name of input worksheet> --prune-except <name of output worksheet> <excel file name> 

See the full list of options:

excel_to_c --help

Gotchas, limitations and bugs

  1. No custom functions, no macros for generating results
  2. Results are cached. So you must call reset(), then set values, then read values.
  3. It must be possible to replace INDIRECT and OFFSET formula with standard references at compile time (e.g., INDIRECT("A"&"1") is fine, INDIRECT(userInput&"3") is not.
  4. Doesn't implement all functions. See which functions are implemented.
  5. Doesn't implement references that involve range unions and lists (but does implement standard ranges)
  6. Sometimes gives cells as being empty, when excel would give the cell as having a numeric value of zero
  7. The generated C version does not multithread and will give bad results if you try.
  8. The generated code uses floating point, rather than fully precise arithmetic, so results can differ slightly.
  9. The generated code uses the sprintf approach to rounding (even-odd) rather than excel's 0.5 rounds away from zero.
  10. Ranges like this: Sheet1!A10:Sheet1!B20 and 3D ranges don't work.

Report bugs: https://github.com/tamc/excel_to_code/issues

Changelog

See Changes.

License

See License

Hacking

Source code: https://github.com/tamc/excel_to_code

Documentation:

Some notes on how Excel works under the hood:

More Repositories

1

Sankey

A javascript library for drawing sankey / flow diagrams
CoffeeScript
252
star
2

rubypeg

RubyPeg helps you to create readable & debug-able Parsing Expression Grammars (PEGs) in ruby
Ruby
7
star
3

twenty-fifty

Note this repository has been superseded by http://github.com/decc/twenty-fifty
Ruby
6
star
4

macc

Code to draw marginal abatement cost curves in javascript
HTML
3
star
5

soks

For posterity: a wiki written in 2004
Ruby
3
star
6

rubyfromexcel

Superseded by https://github.com/tamc/excel_to_code
Ruby
3
star
7

tamc-tangles

Some doodles with the tangle.js library
HTML
2
star
8

tem

Tom's Energy Model
Ruby
2
star
9

metapost-erb

A command and a few support methods to help create metapost files using ruby
Ruby
2
star
10

tom.counsell.org

The source to http://tom.counsell.org
HTML
2
star
11

js-toc

Yet another javascript table of contents generator
CoffeeScript
2
star
12

ruby-script-writer

A small library for programmatically creating well formatted ruby scripts
Ruby
1
star
13

school-catchment-areas

Perl
1
star
14

calculator-workshop-live

C
1
star
15

monty

Demonstration of simple montecarlo simulation
JavaScript
1
star
16

from-excel-to-a-website

Not ready for release
Ruby
1
star
17

Energy-Cost-Converter

e.g.,: Β£m(2009)10-15/kWh to $bn(2010)/GW
Ruby
1
star
18

zenweb-textile

A plugin for zenweb to process .textile files with RedCloth
Ruby
1
star
19

ExcelFormulaParser2

Not ready yet
Swift
1
star
20

osemosys

Fork of the OSeMOSYS open source energy modelling system
1
star
21

zenweb-autolink

A plugin for zenweb that automatically generates links between pages.
Ruby
1
star
22

sok-rail

Not ready yet
Ruby
1
star
23

twenty-fifty-beta

A beta version of the 2050 project
Ruby
1
star