JSON API - addCell

addCell

PREMIUM TRIAL / ADVANCED

Adds cell contents into the Excel spreadsheet.

Note

You are reading the JSON API documentation. For the PHP API method please go to addCell.

JSON data
Key Description
text The content to be inserted.
bold If true the content will be shown in bold characters.
color Hexadecimal color value: "FF0000", "000000"...
font Font family: "Arial", "Calibri"...
fontSize Font size in points.
italic If true displays the content in italics.
strikethrough If true displays text in strikethrough.
subscript If true displays text in subscript.
superscript If true displays text in superscript.
underline Underlines text: "single", "double".
position Cell position in the active sheet: "A1", "C3", "AB7"...
backgroundColor Hexadecimal color value: "FFFF00", "CCCCCC"...
border Border type: thin, thick, dashed, double, mediumDashDotDot, hair... This value can be overridden for each side with "borderTop", "borderRight", "borderBottom", "borderLeft" and "borderDiagonal" properties.
borderColor Hexadecimal color value: "FFFF00", "CCCCCC"... This value can be overridden for each side with "borderColorTop", "borderColorRight", "borderColorBottom", "borderColorLeft" and "borderColorDiagonal" properties.
cellStyleName Cell style name.
  • Custom style name.
  • Preset style names:
    • Bad
    • Calculation
    • Check Cell
    • Comma
    • Currency
    • Explanatory Text
    • Good
    • Heading 1
    • Heading 2
    • Heading 3
    • Heading 4
    • Input
    • Linked Cell
    • Neutral
    • Normal
    • Note
    • Output
    • Percent
    • Warning Text
Applying a cell style name ignores other cell styles.
horizontalAlign
  • left
  • center
  • right
indent Indent value.
isFunction Set the content as function. Default as false. If not set, if the content starts with = , isFunction is set as true (set isFunction as false to avoid this).
locked Locked property.
rotation 60.000ths of a degree.
shrinkToFit If true enables shrink to fit.
textDirection
  • context
  • ltr
  • rtl
type Cell type:
  • general (default)
  • number
  • currency
  • accounting
  • date
  • time
  • percentage
  • fraction
  • scientific
  • text
  • special
  • boolean
  • empty
typeOptions
  • formatCode (string)
verticalAlign top, center, bottom.
wrapText If true enables wrap text.
insertMode Insert mode if the position contains an existing content: "replace", "ignore". Default as replace.
raw Add the raw content if true. Default as false.
useCellStyles Use existing cell styles. Default as false.
Code samples

Example #1

Example #2

Example #3

Example #4

Release notes
  • phpxlsx 6.0:
    • new action.