0.11
# Excel to Code
[![Tests Passing](https://travis-ci.org/tamc/excel_to_code.svg?branch=master)](https://travis-ci.org/tamc/excel_to_code)
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](examples/simple/compile.sh) turns [this spreadsheet](examples/simple/simple.xlsx) into [this Ruby code](examples/simple/ruby/simple.rb) or [this C code](examples/simple/c/simple.c).
# 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
0. No custom functions, no macros for generating results
1. Results are cached. So you must call reset(), then set values, then read values.
2. 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.
3. Doesn't implement all functions. [See which functions are implemented](docs/Which_functions_are_implemented.md).
4. Doesn't implement references that involve range unions and lists (but does implement standard ranges)
5. Sometimes gives cells as being empty, when excel would give the cell as having a numeric value of zero
6. The generated C version does not multithread and will give bad results if you try.
7. The generated code uses floating point, rather than fully precise arithmetic, so results can differ slightly.
8. The generated code uses the sprintf approach to rounding (even-odd) rather than excel's 0.5 rounds away from zero.
9. 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](CHANGES.md).
# License
See [License](LICENSE.md)
# Hacking
Source code: <https://github.com/tamc/excel_to_code>
Documentation:
* [Installing from source](docs/installing_from_source.md)
* [Structure of this project](docs/structure_of_this_project.md)
* [How does the calculation work](docs/how_does_the_calculation_work.md)
* [How to fix parsing errors](docs/How_to_fix_parsing_errors.md)
* [How to implement a new Excel function](docs/How_to_add_a_missing_function.md)
Some notes on how Excel works under the hood:
* [The Excel file structure](docs/implementation/excel_file_structure.md)
* [Relationships](docs/implementation/relationships.md)
* [Workbooks](docs/implementation/workbook.md)
* [Worksheets](docs/implementation/worksheets.md)
* [Cells](docs/implementation/cell.md)
* [Tables](docs/implementation/tables.md)
* [Shared Strings](docs/implementation/shared_strings.md)
* [Array formulae](docs/implementation/array_formulae.md)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.06
GEM providing helper scripts to manage i18n translations in Google Docs. Features: check YAML files for missing translations; export YAML files to CSV; download translations from multiple Google spreadsheets and store to YAML files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.01
# DECC 2050 CALCULATOR TOOL
A C version and ruby wrapper for the www.decc.gov.uk 2050 energy and climate change excel calculator
Further detail on the project:
http://www.decc.gov.uk/2050
Canonical source:
http://github.com/decc/decc_2050_model
## DEPENDENCIES
1. ruby 1.9.2 (including development headers)
2. basic c development headers
This has ONLY been tested on OSX and on Ubuntu 64 bit EC2 ami.
Grateful for reports from other platforms.
In the util folder there is an example script that creates a new EC2 EMI, installs all the dependencies and then compiles the gem. It may be useful if you are trying to figure out the complete set of dependencies.
## INSTALLATION
Note that this compiles the underlying c code, which might take 10-20 minutes or so
gem install decc_2050_model
## UPDATING TO NEWER VERSIONS OF EXCEL MODEL
First of all, you need to be working on the github version of the code, not the rubygem:
git clone http://github.com/decc/decc_2050_model
Then put the new spreadsheet in spreadsheet/model.xlsx
Then, from the top directory of the gem:
bundle
bundle exec rake
The next step is to check whether Rakefile, lib/model/_model_result.rb and lib/model/model_structure.rb need to be altered so that they
pick up the correct places in the underlying excel.
The final stage is to build and install the new gem:
gem build model.gemspec
gem install decc_2050_model-<version>.gem
... where <version> is the version number of the gem file that was created in the folder.
Now follow the instructions in the twenty-fifty server directory in order to ensure that it is using this new version of the gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Soroban makes it easy to extract and execute formulas from Excel spreadsheets. It rewrites Excel formulas as Ruby expressions, and allows you to bind named variables to spreadsheet cells to easily manipulate inputs and capture outputs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.02
Soroban makes it easy to extract and execute formulas from Excel spreadsheets. It rewrites Excel formulas as Ruby expressions, and allows you to bind named variables to spreadsheet cells to easily manipulate inputs and capture outputs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
GEM providing helper scripts to manage i18n translations in Google Docgem. Features: check YAML files for missing translations; export YAML files to CSV; download translations from multiple Google spreadsheets and store to YAML files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
This gems allows simple management of translations from google spreadsheets - it converts google document into yml files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.04
Map google spreadsheets to ruby objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Convert SpreadSheet documents to json following some conventions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Mi Hermano translates strings using the Google Spreadsheets API (since the Translate API is no longer available).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
Extend Rails capabilities of importing and exporting excel files thanks to Spreadsheet gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
Axlsx_Rails provides an Axlsx renderer so you can move all your spreadsheet code from your controller into view files. Partials are supported so you can organize any code into reusable chunks (e.g. cover sheets, common styling, etc.) You can use it with acts_as_xlsx, placing the to_xlsx call in a view and adding ':package => xlsx_package' to the parameter list. Now you can keep your controllers thin!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
GoogleDoc Spreadsheet LanGrove Persistor
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
GoogleDoc Spreadsheet LanGrove Persistor
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Reads hours from a Google Spreadsheet and generates a PDF invoice.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.07
Use GrabzIt to convert HTML or URL's into images, PDF, videos, rendered HTML or DOCX. These captures have highly customizable options include altering quality, delay, size, browser type, geographic location and much more. Additionally GrabzIt can even convert HTML tables on the web into a CSV or Excel spreadsheet. As well as enabling online video's to be converted into animated GIF's.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Push command to Google Spreadsheet
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.01
# DECC 2050 CALCULATOR TOOL
A C version and ruby wrapper for the www.decc.gov.uk 2050 energy and climate change excel calculator
Further detail on the project:
http://www.decc.gov.uk/2050
Canonical source:
http://github.com/decc/decc_2050_model
## DEPENDENCIES
1. ruby 1.9.2 (including development headers)
2. basic c development headers
This has ONLY been tested on OSX and on Ubuntu 64 bit EC2 ami.
Grateful for reports from other platforms.
In the util folder are two example scripts than can be helpful:
1. start-high-memory-instance.sh - is the script we use to setup an aws server to compile the model. You can't use it directly, because you won't have the right keys and certificates, but it can give clues.
2. setup-2050-model-builder-script.sh - is the script we use to get all the dependencies on that aws server correct, download this code, and then compile the model. Again, it may not be quite right for you but can server as inspiration
## INSTALLATION
Note that this compiles the underlying c code, which might take 10-20 minutes or so
gem install decc_2050_model
## UPDATING TO NEWER VERSIONS OF EXCEL MODEL
First of all, you need to be working on the github version of the code, not the rubygem:
git clone http://github.com/decc/decc_2050_model
Then put the new spreadsheet in spreadsheet/2050Model.xlsx
Then, from the top directory of the gem:
bundle
bundle exec rake
The next step is to check whether lib/decc_2050_model/decc_2050_model_result.rb and lib/decc_2050_model/model_structure.rb need to be altered so that they
pick up the correct places in the underlying excel.
The final stage is to build and install the new gem:
gem build decc_2050_model.gemspec
gem install decc_2050_model-<version>.gem
... where <version> is the version number of the gem file that was created in the folder.
Now follow the instructions in the twenty-fifty server directory in order to ensure that it is using this new version of the gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Activity
0.0
Pull google drive spreadsheets with your column names and datatypes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
0.0
A simple yet powerful DSL to create Excel spreadsheets built on top of axlsx gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024