Spreadsheet Workbench/pl

The spreadsheet workbench allows you to create and edit spreadsheets, perform calculations, and retrieve data from a model, and export its data to other spreadsheet applications such as LibreOffice or Microsoft Excel.



Supported Functions
The spreadsheet provides the following functions taking one or two arguments: abs, acos, asin, atan, atan2, cos, cosh, exp, log, log10, mod, pow, sin, sinh, sqrt, tan, tanh

Trigonometric functions use degrees as its default unit; supplying "rad" allows to use radians.

The additional functions: ceil, floor, trunc, and round are available in FreeCAD

The following aggregate functions are supported: average, count, max, min, stddev, sum.

Aggregate functions can take one or more arguments, separated by comma or semicolon. Arguments may include ranges (two cells separated by a colon), e.g =average(B1:B8)

The constants pi and e are predefined.

The conditional statement works like this: = condition ? resultTrue : resultFalse

The condition is defined as an expression that evaluates to either 0 (for false) or non-zero for true. The following comparison operators are defined: ==, !=, >, <, >=, and <=.

Formulas are written as follows: =A2+A3

Cell-references have to be written with upper letters.

Reference To CAD-Data
It is possible to use data from the construction in the spreadsheet. The following table shows some examples:

Cell Properties
The properties of a spreadsheet cell can be edited with a right-click on a cell. The following dialog pops up:



It has several tabs. The following properties can be changed:


 * Text color and background color
 * Text horizontal and vertical alignment
 * Text style: bold, italic, underline
 * Display unit for this cell. Please read the section below.
 * Define an alias-name for this cell. This alias-name can be used in cell-formulas and also in FreeCAD-Expressions

The expressions are explained here: Expressions

Spreadsheet-Data in Expressions
The usage of spreadsheet data in other parts of FreeCAD requires a fully defined name. Because it is possible to have more than one spreadsheet in a document, the spreadsheet name together with the cell name or alias is required. The following pictures showing the usage of an alias "number" from a spreadsheet "MySheet" in an expression in the PartDesign-Workbench.

Typing an "M" shows a list of available names. The arrow-buttons allow to select "MySheet".



Typing an "n" shows now the list of available alias names in MySheet starting with "n". The "number" can be selected with the down-arrow-button. Once a valid name with a usable content is given, the result field will present the calculated length.



Units
The Spreadsheet uses units. If a number has a unit, this unit will be used in all calculations. The multiplication of two length with the unit mm gives an area with the unit mm&sup2;.

You can switch the length-unit from mm to inch in the dialog, you get with a right-click on a cell. The cell will now show the length in inches. The value used for calculations does not change. The results of a formula using this value do not change, when the shown unit of an input was changed. The result is still calculated from the length in mm.

A number without a unit cannot be changed in a number with unit by the cell properties dialog. One can put in a unit string, that will also be shown, but the cell still contains only a number without unit.

Sometime it is desirably to get rid of a unit. This can only to be done by multiplying with 1 with a reciprocal unit.

Current Limitations
It is not possible providing data for a geometry, for example a length, in a spreadsheet and retrieving in the same spreadsheet the volume of the resulting shape. This will create a circular reference. This is a design decision. However, it is possible to use two different spreadsheets: one as data-source for geometry and another for reporting geometry-data.

It is not possible to select and copy multiple cells. Only the content of a cell from the input field can be copied and paste into the input field of another cell.

For FreeCAD earlier versions see Spreadhseet legacy