Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are good methods to perform spreadsheet-like calculations in a programming language?

What's the best way to do spreadsheet-like calculations in a programming language? Example: A multi-user application needs to be available over the web that crunches columns and cells of numbers like a spread-sheet based on user submission. What are the best data structures/ database models/patterns to handle this type of work so that handling the different columns are done efficiently and easily in php, java, or even .Net. Is it better to use data structures within the language, or is it better to use a database? If using a database is the way, how does one go about doing this?

like image 893
Kunle Avatar asked Aug 05 '09 18:08

Kunle


People also ask

What coding language does spreadsheet use?

The language employed by Excel and Google Sheets is “the world's most widely used programming language. Excel formulas are written by an order of magnitude more users than all the C, C++, C#, Java, and Python programmers in the world combined.”

What type of software would you use to create a list of calculations?

Examples of spreadsheet programs are Google sheet (web-based spreadsheet program founded by Google), MS-Excel (works offline), LibreOffice, Lotus spreadsheet, etc.

What language is used to program in Excel?

VBA stands for Visual Basic for Applications. Excel VBA is Microsoft's programming language for Excel and all the other Microsoft Office programs, like Word and PowerPoint. The Office suite programs all share a common programming language.


1 Answers

To do the actual calculation, look at graph theory. Basically you want to represent each cell as a node in a graph and each dependency as a directed edge. Next, do a topological sort to calculate the value of each cell in the right order.

like image 165
subb Avatar answered Oct 19 '22 23:10

subb