Git Product home page Git Product logo

excel_to_code's Introduction

excel_to_code's People

Contributors

sliiser avatar tamc avatar vongrippen 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

excel_to_code's Issues

Any chance of parallelising this?

I haven't tried myself yet, but wanted to check whether you'd tried parallelising some of the code, to speed it up on multi-processor machines.

I'm already using command.run_in_memory = true, which gives a big improvement in performance - 60% saving on time compiling decc_model

got ExternalReferenceException but there's no external reference in document

Hi,

I got error message 'Named reference xiv.a.area [1]Control!E62 not parsed

/Users/myname/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/excel_to_code-0.3.13/src/rewrite/caching_formula_parser.rb:93:in `external_reference': ExternalReferenceException

in my sheets "xiv.a" cell E62. it's just an empty cell. I've try to remove the related sheets. and remove all sheets and leave one sheet. still get the same error

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Example spreadsheet tests fail

ExcelToC Should transform ExampleSpreadsheet.xlsx into the desired c code

Failure: test_ranges_c3(TestExampleSpreadsheet [/Users/tamc/Documents/github/excel_to_code/spec/commands/excel_to_X_output_actual/c/test_examplespreadsheet.rb:46]: <:name> expected but was <0.0>.

ExcelToRuby Should transform ExampleSpreadsheet.xlsx into the desired ruby code

test_ranges_c3(TestExampleSpreadsheet [/Users/tamc/Documents/github/excel_to_code/spec/commands/excel_to_X_output_actual/c/test_examplespreadsheet.rb:46]: <:name> expected but was <0.0>.

Uninitialized constant Getsetranges

NameError: uninitialized constant Decc2050ModelShim::Getsetranges
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model.rb:55:in `set'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model.rb:19:in `method_missing'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_utilities.rb:46:in `block in set_array'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_utilities.rb:44:in `each'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_utilities.rb:44:in `each_with_index'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_utilities.rb:44:in `set_array'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_utilities.rb:29:in `set_choices'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_result.rb:17:in `block in calculate_pathway'
    <internal:prelude>:28:in `block in exclusive'
    <internal:prelude>:10:in `synchronize'
    <internal:prelude>:27:in `exclusive'
    /Users/tamc/Documents/2050/decc_2050_model/lib/decc_2050_model/decc_2050_model_result.rb:15:in `calculate_pathway'
    test_decc_2050_model_result.rb:20:in `block in test_results'
    test_decc_2050_model_result.rb:14:in `each'
    test_decc_2050_model_result.rb:14:in `test_results'

Error trying to convert my spreadsheet.

Hi, im trying to conver a xlsx file to c with this code

command = ExcelToC.new
command.excel_file = 'my_path_file'
command.output_directory = 'my_path_output'
command.output_name = 'test_model_c'
command.named_references_that_can_be_set_at_runtime = { "Control" => (44.upto(117).to_a.map { |r| "f#{r}" }) }

command.cells_to_keep = {
  "Resultados Intermedios" => :all, 
}
command.actually_compile_code = true
command.actually_run_tests = true
command.go!

As result i get this trace

16:51   Excel to Code version 0.3.17

16:51   Removing any old xml
bin/rails: No such file or directory - unzip -q 'c:/sites/calculator2050/docs/model/modelo_prueba.xlsx' -d 'C:/User
DRI~1/AppData/Local/Temp/d20170829-3496-1aaihpy'
16:51   Unziping excel into xml
16:51   Extracting shared strings
16:51   C:/Users/PRODRI~1/AppData/Local/Temp/d20170829-3496-1aaihpy/xl/sharedStrings.xml does not exist in xml(["sh
trings.xml"]), using blank instead
16:51   Extracting named references
16:51   C:/Users/PRODRI~1/AppData/Local/Temp/d20170829-3496-1aaihpy/xl/workbook.xml does not exist in xml(["workboo
"]), using blank instead
16:51   Extracting worksheet names
16:51   C:/Users/PRODRI~1/AppData/Local/Temp/d20170829-3496-1aaihpy/xl/workbook.xml does not exist in xml(["workboo
"]), using blank instead
16:51   C:/Users/PRODRI~1/AppData/Local/Temp/d20170829-3496-1aaihpy/xl/_rels/workbook.xml.rels does not exist in xm
rels", "workbook.xml.rels"]), using blank instead
16:51   Extracting Tables
16:51   Cells to keep includes :"Resultados Intermedios" but could not be found in workbook: []
Completed 500 Internal Server Error in 156ms

Is there something im doing wrong?

Here is my xlsx file in case of...

Additional dependency - unzip, consider replacing with zlib?

I tried running excel_to_ruby on a fresh install of Ubuntu 20.0.4 LTS, after installing ruby and bundler, and got the following error:

09:53   Excel to Code version 0.3.19
09:53   Removing old folders
/home/tur-ium/.rvm/gems/ruby-2.5.8/gems/excel_to_code-0.3.19/src/commands/excel_to_x.rb:299: warning: Insecure world writable dir /home/tur-ium/.rvm/gems/ruby-2.5.8/bin in PATH, mode 040777
09:53   Unzipping the spreadsheet
Traceback (most recent call last):
        5: from translate_excel_into_c.rb:46:in `<main>'
        4: from translate_excel_into_c.rb:29:in `translate_excel_into_c'
        3: from /home/tur-ium/.rvm/gems/ruby-2.5.8/gems/excel_to_code-0.3.19/src/commands/excel_to_x.rb:150:in `go!'
        2: from /home/tur-ium/.rvm/gems/ruby-2.5.8/gems/excel_to_code-0.3.19/src/commands/excel_to_x.rb:294:in `unzip_excel'
        1: from /home/tur-ium/.rvm/gems/ruby-2.5.8/gems/excel_to_code-0.3.19/src/commands/excel_to_x.rb:299:in execute_system_command'
/home/tur-ium/.rvm/gems/ruby-2.5.8/gems/excel_to_code-0.3.19/src/commands/excel_to_x.rb:299:in ': No such file or directory - unzip (Errno::ENOENT)

It looks like excel_to_code executes the system command unzip, but this is not installed by default on Ubuntu, and many other Linux distributions. It may be more robust to use a dedicated Ruby module for unzipping, such as zlib, or to ensure unzip is noted a dependency in the Ubuntu repo.

Fails with some Chinese characters

Zhang Bo reports that this formula appears to throw an error on parsing:

index(indirect("全局假设["&$C397&"]"),match(F$396,indirect("全局假设[年份]"),0))

rspec test case failure: ReplaceIndirectsWithReferences

Where is the X.a.autoproducao.info coming from?

Failures:

  1) ReplaceIndirectsWithReferences should replace INDIRECT() functions with the reference that they refer to, if they have been passed a string value
     Failure/Error: output.string.should == expected_output
     
       expected: "A1\t[:cell, :\"$A$5\"]\nA2\t[:function, :INDIRECT, [:cell, :\"$A$5\"]]\nA3\t[:function, :SUM, [:area...r, \"3\"]]\nA5\t[:cell, :\"$A$5\"]\nA6\t[:table_reference, \"X.a.autoproducao.info\", \"Vector\"]\n"
            got: "A1\t[:cell, :\"$A$5\"]\nA2\t[:function, :INDIRECT, [:cell, :\"$A$5\"]]\nA3\t[:function, :SUM, [:area...constant, \"C3545\"]], [:number, \"3\"]]\nA5\t[:cell, :\"$A$5\"]\nA6\t[:named_reference, \"X.a\"]\n" (using ==)
       Diff:
       @@ -3,5 +3,5 @@
        A3	[:function, :SUM, [:area, :"$A$5", :"$B$10"]]
        A4	[:function, :IFERROR, [:function, :INDEX, [:error, "#VALUE!"], [:constant, "C3545"]], [:number, "3"]]
        A5	[:cell, :"$A$5"]
       -A6	[:table_reference, "X.a.autoproducao.info", "Vector"]
       +A6	[:named_reference, "X.a"]

_xlfn.SINGLE when running a .xlsm file

I want to use the tamc excel_to_code to convert an .xlsm file to code but as clean as my excel workbook is, it keeps bringing a _xlfn.SINGLE error when I run the code. Kindly assist

Freeing memory is very slow

With the 2050 pathway calculator example: calculating the pathway takes about 40ms. The reset method that frees allocated memory increases this to 120ms.

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.