File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Converting SQL to Excel formulas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Converting SQL to Excel formulas" Watch "Converting SQL to Excel formulas" New topic

Converting SQL to Excel formulas

Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2746

I have crossposted this on the antlr-discussion google group because Antlr is a solution I am exploring

'm trying to build something that can parse a where clause and convert it into an Excel formula. The Excel sheet has named cells corresponding to the database columns. So, I want to be able to do something like parse a where clause "ColA > 20 and ColB='XXX'" into "=AND(ColA>20,ColB="XXX")". Or alternatively, if there is something that can parse the SQL where clause and give me an expression tree, I can do my thing right in Java, and I don;t really need to generate an Excel formula.

Anyone know if there is a OTS solution for this?

I was looking at ANTLR and someone mentioned that ANTLR already has the grammar for ANSI SQL. I couldn;t find it because I guess ANTLRv4 just got released and their documentation hasn't caught up yet. I don't need a full SQL parser, just the Where clause. So, it should be a much simpler grammar.
I agree. Here's the link:
subject: Converting SQL to Excel formulas
It's not a secret anymore!