createXLSX
To dynamically create customizable, styled, multi-sheet Excel files directly from databases
With this function, you can create an .xlsx
file with customizable content and multiple sheets, reflecting the data and style defined in the input parameters.
The resulting file is saved directly in Ninox, offering dynamic data management and formatting options.
Syntax
createXLSX(nid, any, string)
Return
file
Examples
Using createXLSX()
createXLSX()
To create an Excel file with the createXLSX()
function:
Create a Button field: When clicked, the button triggers a function to create an Excel file from the data provided in the formula editor.
Create an Image field: Serves a link, allowing you to download the file directly
Enable edit mode and click the On click field. In the formula editor:
Define the columns and rows.
Define the worksheet structure.
Use the
createXLSX()
function.Define styles and formatting (optional).
Save the script. Create the Excel file by clicking the button.
Define columns and rows
First, create an object to define the columns:
Next, define the rows. You can use Supported special fields, if you need to:
Define worksheet structure
Define a worksheet with columns and rows:
Use createXLSX()
Call the createXLSX()
function with the defined worksheets:
Define styles and formatting (optional)
Apply style to a header cell
Apply style to an entire column except the header
Apply style to an entire row
Apply style to specific cells in a row
Create Excel file
Finally, when you've saved your script, click the button to create an Excel file.
Supported styles and formatting options
Font
Font formatting options
Font property | Description | Example value(s) |
---|---|---|
name | Specifies the font name. | "Arial" "Calibri" etc. |
family | Specifies the font family for fallback as an integer value. | 1 - Serif 2 - Sans Serif 3 - Mono Others - unknown |
scheme | Specifies the font scheme. | "minor" "major" "none" |
charset | Specifies the font character set as an integer value. | 1 2 etc. |
size | Specifies the font size as an integer value. | 9 10 12 16 etc. |
color | Specifies the font color as an ARGB object. | { argb: "FFFF0000" } |
bold | Specifies whether the font is bold, indicating weight. | true false |
italic | Specifies whether the font is italic, indicating slope. | true false |
underline | Specifies the font underline style. | true false "none" "single" "double" "singleAccounting" "doubleAccounting" |
strike | Specifies whether the font has strikethrough. | true false |
outline | Specifies whether the font has an outline. | true false |
vertAlign | Specifies the font's vertical alignment. | "superscript" "subscript" |
Alignment
Alignment formatting options
horizontal | vertical | wrapText | shrinkToFit | indent | readingOrder | textRotation |
---|---|---|---|---|---|---|
left | top | true | true | integer | rtl | 0 to 90 |
center | middle | false | false |
| ltr | -1 to -90 |
right | bottom |
|
|
|
| vertical |
fill | distributed |
|
|
|
|
|
justify | justify |
|
|
|
|
|
centerContinuous |
|
|
|
|
|
|
distributed |
|
|
|
|
|
|
Borders
Valid border styles
thin
dotted
dashDot
hair
dashDotDot
slantDashDot
mediumDashed
mediumDashDotDot
mediumDashDot
medium
double
thick
Fills
Pattern fills
Property | Required | Description |
---|---|---|
type | Yes | Specifies that this fill uses a pattern. |
pattern | Yes | |
fgColor | No | Specifies the pattern's foreground color. The default color is black. |
bgColor | No | Specifies the pattern's background color. The default color is white. |
To fill a cell using the solid
pattern, you don't need to specify bgColor
.
Valid pattern types
none
solid
darkGray
mediumGray
lightGray
gray125
gray0625
darkHorizontal
darkVertical
darkDown
darkUp
darkGrid
darkTrellis
lightHorizontal
lightVertical
lightDown
lightUp
lightGrid
lightTrellis
Gradient fills
Property | Required | Description |
---|---|---|
type | Yes | Specifies that this fill uses a gradient. |
gradient | Yes | Defines the type of gradient, which can be either "angle" or "path." |
degree | angle |
|
center | path |
|
stops | Yes |
|
Supported special fields
The function supports special fields like hyperlinks, rich text, and formulas:
Hyperlinks provide links to web content or internal references.
Rich text allows for mixed-format text, including bold, italic, and other font styles.
Formulas enable cells to compute values dynamically.
Dates can be used directly from Ninox.
Hyperlinks
Rich text
Formula
Dates
Last updated