createXLSX
To dynamically create customizable, styled, multi-sheet Excel files directly from databases
Last updated
To dynamically create customizable, styled, multi-sheet Excel files directly from databases
Last updated
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.
createXLSX(nid, any, string)
file
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.
First, create an object to define the columns:
Next, define the rows. You can use Supported special fields, if you need to:
Define a worksheet with columns and rows:
createXLSX
Call the createXLSX
function with the defined worksheets:
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:
Finally, when you've saved your script, click the button to create an Excel file.
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"
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
thin
dotted
dashDot
hair
dashDotDot
slantDashDot
mediumDashed
mediumDashDotDot
mediumDashDot
medium
double
thick
type
Yes
Specifies that this fill uses a pattern.
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
.
none
solid
darkGray
mediumGray
lightGray
gray125
gray0625
darkHorizontal
darkVertical
darkDown
darkUp
darkGrid
darkTrellis
lightHorizontal
lightVertical
lightDown
lightUp
lightGrid
lightTrellis
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
Indicates the gradient's direction.
A value of 0 places it from left to right.
Values from 1 to 359 rotate the direction clockwise.
center
path
Specifies the relative coordinates for the start of the gradient path.
"Left" and "Top" values range from 0 to 1.
stops
Yes
Specifies the gradient's color sequence.
An array of objects defines the position and color, starting at position 0 and ending at position 1.
Additional positions can specify other colors on the path.
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.