<p>I want to eventually add support for creating Pivot tables in my xlsx/docx/pptx library gooxml. A precursor to that is implementing an Excel formula evaluator to allow creating a pivot table from possibly computed values. I've finished implementing an evaluator as well as support for around 100 common Excel functions (e.g. SUM, IF, etc.). It's not 100% compatible with Excel, but there are several hundred test cases on non-trivial formulas and it should easily handle evaluating the vast majority of commonly used spreadsheet formulas. </p>
<p>If you've ever wanted to implement a parser in go with Ragel & goyacc, I think this may serve as a good example of one way to approach it. The code is at <a href="https://github.com/baliance/gooxml/tree/master/spreadsheet/formula">https://github.com/baliance/gooxml/tree/master/spreadsheet/formula</a></p>
<ul>
<li>lever.rl Ragel input</li>
<li>grammar.y goyacc input</li>
</ul>
<hr/>**评论:**<br/><br/>siwu: <pre><p>Thanks a lot, this a part of Go that's rather obscure to most people and it's great to see it used outside the Go repo itself.</p></pre>baliance: <pre><p>There's also a more simple Ragel/Go example at <a href="https://github.com/baliance/gooxml/tree/master/spreadsheet/format" rel="nofollow">https://github.com/baliance/gooxml/tree/master/spreadsheet/format</a> There I use Ragel to create a lexer for Excel's number format strings (e.g. "0","$#,##0", "dd-mm-yy", etc.) to allow retrieving a value from a spreadsheet as Excel would display it. </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传