Vue Data GridExcel Export API Reference

Enterprise

This page documents the Excel Export API and Interfaces.

Grid Properties

defaultExcelExportParams
A default configuration object used to export to Excel.
suppressExcelExport
boolean
default: false
Prevents the user from exporting the grid to Excel.
A list (array) of Excel styles to be used when exporting to Excel with styles.

API Methods

exportDataAsExcel
Function
Downloads an Excel export of the grid's data.
getDataAsExcel
Function
Similar to exportDataAsExcel, except instead of downloading a file, it will return a Blob to be processed by the user.
getSheetDataForExcel
Function
This is method to be used to get the grid's data as a sheet, that will later be exported either by getMultipleSheetsAsExcel() or exportMultipleSheetsAsExcel().
exportMultipleSheetsAsExcel
Function
Downloads an Excel export of multiple sheets in one file.
getMultipleSheetsAsExcel
Function
Similar to exportMultipleSheetsAsExcel, except instead of downloading a file, it will return a Blob to be processed by the user.

Interfaces

ExcelExportParams

Properties available on the ExcelExportParams interface.

addImageToCell
Function
Use to export an image for the gridCell in question.
allColumns
boolean
default: false
If true, all columns will be exported in the order they appear in the columnDefs. When false only the columns currently being displayed will be exported.
appendContent
ExcelRow[]
Content to put at the top of the exported sheet. An array of ExcelRow objects, see Extra Content section.
author
string
default: "AG Grid"
The author of the exported file. @default "AG Grid"
autoConvertFormulas
boolean
default: false
If set to true, this will try to convert any cell that starts with = to a formula, instead of setting the cell value as regular string that starts with =.
columnKeys
(string | Column)[]
Provide a list (an array) of column keys or Column objects if you want to export specific columns.
columnWidth
number | ((params: ColumnWidthCallbackParams) => number)
Defines the default column width. If no value is present, each column will have value currently set in the application with a min value of 75px. This property can also be supplied a callback function that returns a number.
exportAsExcelTable
Used to add an Excel table to the spreadsheet. Set to true to use default export table config, or provide a config object. @default false
exportedRows
'all' | 'filteredAndSorted'
default: 'filteredAndSorted'
Determines whether rows are exported before being filtered and sorted.
fileName
string | ExportFileNameGetter
default: export.xlsx
String to use as the file name or a function that returns a string.
fontSize
number
default: 11
The default value for the font size of the Excel document.
freezeColumns
'pinned' | ExcelFreezeColumnsGetter
Use this property to select to freeze columns at the start of the grid (this will be the columns at the right for RTL).
  • pinned - Freeze all pinned left (right for RTL grids) columns.
  • A callback function that will freeze columns until a value other than true is returned. After that, this callback will no longer be executed.
  • freezeRows
    'headers' | 'headersAndPinnedRows' | ExcelFreezeRowsGetter
    Use this property to select to freeze rows at the top of the exported sheet.
  • headers - Freeze all grid headers at the top.
  • headersAndPinnedRows - Freeze all headers and pinned top rows.
  • A callback function that will freeze rows until a value other than true is returned, after that, this callback will no longer be executed. Note that using a callback will automatically freeze all header rows.
  • getCustomContentBelowRow
    Function
    A callback function to return content to be inserted below a row in the export.
    headerFooterConfig
    The configuration for header and footers.
    headerRowHeight
    number | ((params: RowHeightCallbackParams) => number)
    The height in pixels of header rows. Defaults to Excel default value. This property can also be supplied a callback function that returns a number.
    The Excel document page margins. Relevant for printing.
    mimeType
    string
    default: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    The mimeType of the Excel file.
    onlySelected
    boolean
    default: false
    Export only selected rows.
    onlySelectedAllPages
    boolean
    default: false
    Only export selected rows including other pages (only makes sense when using pagination).
    Allows you to setup the page orientation and size.
    prependContent
    ExcelRow[]
    Content to put at the bottom of the exported sheet. An array of ExcelRow objects, see Extra Content section.
    processCellCallback
    Function
    A callback function invoked once per cell in the grid. Return a string value to be displayed in the export. For example this is useful for formatting date values.
    processGroupHeaderCallback
    Function
    A callback function invoked once per column group. Return a string to be displayed in the column group header. Note that column groups are exported by default, this option will not work with skipColumnGroupHeaders=true.
    processHeaderCallback
    Function
    A callback function invoked once per column. Return a string to be displayed in the column header.
    processRowGroupCallback
    Function
    A callback function invoked once per row group. Return a string to be displayed in the group cell.
    rightToLeft
    boolean
    default: undefined
    Use to set the direction for the worksheet.
  • true: Sets the direction to right-to-left (RTL).
  • false: Sets the direction to left-to-right (LTR).
  • undefined: Exports the worksheet according to the current direction of the grid as set by gridOptions.enableRtl.
  • rowGroupExpandState
    'expanded' | 'collapsed' | 'match'
    default: 'expanded'
    The expand/collapse state of each row group in the Excel Document.
  • expanded: All row groups will be expanded by default.
  • collapsed: All row groups will be collapsed by default.
  • match: The row groups will match their current state in the Grid.
  • rowHeight
    number | ((params: RowHeightCallbackParams) => number)
    The height in pixels of all rows. Defaults to Excel default value. This property can also be supplied a callback function that returns a number.
    rowPositions
    RowPosition[]
    Row node positions.
    sheetName
    string | ExcelSheetNameGetter
    default: 'ag-grid'
    The name of the sheet in Excel where the grid will be exported. Either a string or a function that returns a string can be used. If a function is used, it will be called once before the export starts. There is a max limit of 31 characters per sheet name.
    shouldRowBeSkipped
    Function
    A callback function that will be invoked once per row in the grid. Return true to omit the row from the export.
    skipColumnGroupHeaders
    boolean
    default: false
    Set to true to exclude header column groups.
    skipColumnHeaders
    boolean
    default: false
    Set to true if you don't want to export column headers.
    skipPinnedBottom
    boolean
    default: false
    Set to true to suppress exporting rows pinned to the bottom of the grid.
    skipPinnedTop
    boolean
    default: false
    Set to true to suppress exporting rows pinned to the top of the grid.
    skipRowGroups
    boolean
    default: false
    Set to true to skip row group headers if grouping rows. Only relevant when grouping rows.
    suppressColumnOutline
    boolean
    default: false.
    If true, the outline (controls to expand and collapse) for Group Columns will not be added automatically to the Excel Document.
    suppressRowOutline
    boolean
    default: false.
    If true, the outline (controls to expand and collapse) for Row Groups will not be added automatically to the Excel Document.

    ExcelExportMultipleSheetParams

    Properties available on the ExcelExportMultipleSheetParams interface.

    See Multiple Sheets for more information.

    data
    string[]
    Array of strings containing the raw data for Excel workbook sheets. This property is only used when exporting to multiple sheets using api.exportMultipleSheetsAsExcel() and the data for each sheet is obtained by calling api.getSheetDataForExcel().
    activeSheetIndex
    number
    default: 0
    The index of the sheet to be marked as active by default.
    fileName
    string | ExportFileNameGetter
    default: 'export.xlsx'
    String to use as the file name or a function that returns a string.
    author
    string
    default: "AG Grid"
    The author of the exported file. @default "AG Grid"
    fontSize
    number
    default: 11
    The default value for the font size of the Excel document.
    mimeType
    string
    default: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    The mimeType of the Excel file.

    ExcelAlignment

    Properties available on the ExcelAlignment interface.

    horizontal
    | 'Automatic' | 'Left' | 'Center' | 'Right' | 'Fill' | 'Justify' | 'CenterAcrossSelection' | 'Distributed' | 'JustifyDistributed'
    default: 'Automatic'
    Use this property to change the cell horizontal alignment.
    indent
    number
    default: 0
    Use this property to change the level of indentation in the cell.
    readingOrder
    'RightToLeft' | 'LeftToRight' | 'Context'
    default: 'LeftToRight'
    Use this property to change the cell reading order.
    rotate
    number
    default: 0
    The number of degrees between 0 and 359 to rotate the text.
    shrinkToFit
    boolean
    default: false
    If set to true, the font size of the cell will automatically change to force the text to fit within the cell.
    vertical
    'Automatic' | 'Top' | 'Bottom' | 'Center' | 'Justify' | 'Distributed' | 'JustifyDistributed'
    default: 'Automatic'
    Use this property to change the cell vertical alignment.
    wrapText
    boolean
    default: false
    If set to true, multiline text will be displayed as multiline by Excel.

    ExcelBorders

    Properties available on the ExcelBorders interface.

    borderBottom
    Use to set the cell's bottom border.
    borderLeft
    Use to set the cell's left border.
    borderRight
    Use to set the cell's right border.
    borderTop
    Use to set the cell's top border.

    ExcelBorder

    Properties available on the ExcelBorder interface.

    color
    string
    default: 'black'
    The color or the border.
    lineStyle
    'None' | 'Continuous' | 'Dash' | 'Dot' | 'DashDot' | 'DashDotDot' | 'SlantDashDot' | 'Double'
    default: 'None'
    The style of the border.
    weight
    0 | 1 | 2 | 3
    default: 0
    The thickness of the border from 0 (thin) to 3 (thick).

    ExcelCell

    Properties available on the ExcelCell interface.

    The data that will be added to the cell.
    ref
    string
    Cell reference.
    collapsibleRanges
    number[][]
    Collapsible ranges.
    styleId
    string | string[]
    The ExcelStyle id to be associated with the cell.
    mergeAcross
    number
    default: 0
    The number of cells to span across (1 means span 2 columns).

    ExcelData

    Properties available on the ExcelData interface.

    type required
    ExcelDataType | ExcelOOXMLDataType
    The type of data being in the cell.
    value required
    string | null
    The value of the cell.

    ExcelFont

    Properties available on the ExcelFont interface.

    bold
    boolean
    default: false
    Set to true to set the cell text to bold.
    color
    string
    default: '#000000'
    The color of the cell font.
    family
    string
    default: 'Automatic'
    The family of the font to used in the cell. Options: Automatic,Roman,Swiss,Modern,Script,Decorative,
    fontName
    string
    default: 'Calibri'
    The name of the font to be used in the cell.
    italic
    boolean
    default: false
    Set to true to display the cell font as italic.
    outline
    boolean
    default: false
    Set to true to add a text outline.
    shadow
    boolean
    default: false
    Set to true to add text shadow.
    size
    number
    Set this property to used a different font size other than the default.
    strikeThrough
    boolean
    default: false
    Set to true to add a strikeThrough line.
    underline
    'Single' | 'Double'
    Use this property to underline the cell text.
    verticalAlign
    'Superscript' | 'Subscript'
    Use this property to change the default font alignment. Note: This is different than setting cell vertical alignment.

    ExcelHeaderFooterConfig

    Properties available on the ExcelHeaderFooterConfig interface.

    The configuration for header and footer on every page.
    The configuration for header and footer on the first page only.
    The configuration for header and footer on even numbered pages only.

    ExcelHeaderFooter

    Properties available on the ExcelHeaderFooter interface. At least one of header or footer is required or both.

    An array of maximum 3 items (Left, Center, Right), containing header configurations.
    An array of maximum 3 items (Left, Center, Right), containing footer configurations.

    ExcelHeaderFooterContent

    Properties available on the ExcelHeaderFooterContent interface.

    value required
    string
    The value of the text to be included in the header.
    When value is &[Picture], this should be used as the referenced image.
    position
    'Left' | 'Center' | 'Right'
    default: 'Left'
    Configures where the text should be added: Left, Center or Right.
    The font style of the header/footer value.

    ExcelHeaderFooterImage

    Properties available on the ExcelHeaderFooterImage interface.

    width required
    number
    The width of the image in pixels.
    height required
    number
    The height of the image in pixels.
    id required
    string
    The image id. This field is required so the same image doesn't get imported multiple times.
    base64 required
    string
    A base64 string that represents the image being imported.
    imageType required
    'jpg' | 'png' | 'gif'
    The type of image being exported.
    recolor
    'Grayscale' | 'Black & White' | 'Washout'
    Set this property to select a preset that changes the appearance of the image.
    brightness
    number
    The brightness of the image between 0 and 100 (if recolor is used, this value will only be applied for Grayscale). Default 50
    contrast
    number
    The contrast of the image between 0 and 100. (If recolor is used, this value will only be applied for Grayscale.). Default 50
    altText
    string
    Alt Text for the image.

    ExcelImage

    Properties available on the ExcelImage interface.

    id required
    string
    The image id. This field is required so the same image doesn't get imported multiple times.
    base64 required
    string
    A base64 string that represents the image being imported.
    imageType required
    'jpg' | 'png' | 'gif'
    The type of image being exported.
    fitCell
    boolean
    default: false
    If set to true, the image will cover the whole cell that is being imported to. This property does not apply to images in the Header/Footer
    transparency
    number
    default: 0
    Set a value between 0 - 100 that will indicate the percentage of transparency of the image.
    rotation
    number
    default: 0
    Set a value between 0 - 359 that will indicate the number of degrees to rotate the image clockwise.
    recolor
    'Grayscale' | 'Sepia' | 'Washout'
    Set this property to select a preset that changes the appearance of the image.
    width
    number
    The width of the image in pixels. If this value is not selected, fitCell will be automatically set to true.
    height
    number
    The height of the image in pixels. If this value is not selected, fitCell will be automatically set to true.
    Position of the image.
    altText
    string
    Alt Text for the image.

    ExcelImagePosition

    Properties available on the ExcelImagePosition interface.

    row
    number
    The row containing this image. This property is set automatically, don't change it unless you know what you are doing.
    rowSpan
    number
    default: 1
    The amount of rows this image will cover. @default 1
    column
    number
    The column containing this image. This property is set automatically, don't change it unless you know what you are doing.
    colSpan
    number
    default: 1
    The amount of columns this image will cover.
    offsetX
    number
    default: 0
    The amount in pixels the image should be offset horizontally.
    offsetY
    number
    default: 0
    The amount in pixels the image should be offset vertically.

    ExcelInterior

    Properties available on the ExcelInterior interface.

    pattern
    | 'None' | 'Solid' | 'Gray75' | 'Gray50' | 'Gray25' | 'Gray125' | 'Gray0625' | 'HorzStripe' | 'VertStripe' | 'ReverseDiagStripe' | 'DiagStripe' | 'DiagCross' | 'ThickDiagCross' | 'ThinHorzStripe' | 'ThinVertStripe' | 'ThinReverseDiagStripe' | 'ThinDiagStripe' | 'ThinHorzCross' | 'ThinDiagCross'
    Use this property to set background color patterns.
    color
    string
    The colour to be used as a secondary colour combined with patterns.
    patternColor
    string
    The pattern color.

    ExcelNumberFormat

    Properties available on the ExcelNumberFormat interface.

    format
    string
    Use this property to provide a pattern to format a number. (eg. 10000 could become $10,000.00).

    ExcelProtection

    Properties available on the ExcelProtection interface.

    protected
    boolean
    default: true
    Set to false to disable cell protection (locking)
    hideFormula
    boolean
    default: false
    Set to true to hide formulas within protected cells.

    ExcelSheetMargin

    Properties available on the ExcelSheetMargin interface.

    top
    number
    default: 0.75
    The sheet top margin.
    right
    number
    default: 0.7
    The sheet right margin.
    bottom
    number
    default: 0.75
    The sheet bottom margin.
    left
    number
    default: 0.7
    The sheet left margin.
    header
    number
    default: 0.3
    The sheet header margin.
    number
    default: 0.3
    The sheet footer margin.

    ExcelSheetPageSetup

    Properties available on the ExcelSheetPageSetup interface.

    orientation
    'Portrait' | 'Landscape'
    default: 'Portrait'
    Use this property to change the print orientation.
    pageSize
    | 'Letter' | 'Letter Small' | 'Tabloid' | 'Ledger' | 'Legal' | 'Statement' | 'Executive' | 'A3' | 'A4' | 'A4 Small' | 'A5' | 'A6' | 'B4' | 'B5' | 'Folio' | 'Envelope' | 'Envelope DL' | 'Envelope C5' | 'Envelope B5' | 'Envelope C3' | 'Envelope C4' | 'Envelope C6' | 'Envelope Monarch' | 'Japanese Postcard' | 'Japanese Double Postcard'
    default: 'Letter'
    Use this property to set the sheet size.

    ExcelTableConfig

    Properties available on the ExcelTableConfig interface.

    name
    string
    default: 'AG-GRID-TABLE'
    This property is used to set the table name. It should be an alphanumeric string with no special characters.
    showFilterButton
    boolean | 'match'
    default: match
    Set this property to false to disable the filter button at the exported Excel table header. Set it to true to show the filter button on all columns. Set it to match to show the filter button only if the column has a filter allowed.
    showRowStripes
    boolean
    default: true
    Set this property to false to hide the row stripes.
    showColumnStripes
    boolean
    default: false
    Set this property to true to show column stripes.
    highlightFirstColumn
    boolean
    default: false
    Set this property to true to show the first column in bold/highlighted style.
    highlightLastColumn
    boolean
    default: false
    Set this property to true to show the last column in bold/highlighted style.

    ExcelStyle

    Properties available on the ExcelStyle interface.

    id required
    string
    The id of the Excel Style, this should match a CSS cell class.
    Use this property to customise cell alignment properties.
    Use this property to customise cell borders.
    Use this property to specify the type of data being exported.
    Use this property to customise the font used in the cell.
    Use this property to customise the cell background.
    numberFormat
    Use this property to customise the cell value as a formatted number.
    protection
    Use this property to setup cell protection.

    Types

    ExcelDataType

    type ExcelDataType = 
        'String'   |
        'Formula'  |
        'Number'   |
        'Boolean'  |
        'DateTime' |
        'Error'
    

    ExcelOOXMLDataType

    type ExcelOOXMLDataType = 
        'str'       |
        's'         |
        'f'         |
        'inlineStr' |
        'n'         |
        'b'         |
        'd'         |
        'e'         |
        'empty'