Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Div
idProductTOC

On this page

Table of Contents
maxLevel1
excludeOn this page
typeflat
separator |

Overview

Excerpt

The CSV macro can import, format and display comma-separated values (CSV) data from anywhere, by:

  • Reading the CSV data from any of these sources:
    1. Within your Confluence page.
    2. From a file residing on the Confluence server (Server only).
    3. From a global or space template (Server only).
    4. From a page attachment.
    5. From an external URL.
  • Allowing customizable delimiters, quote characters, and character encoding.
  • Supporting inclusion of Wiki Markup macros within the CSV data.
  • Combining with the Chart macro to produce powerful data visualization.
  • Leveraging the same table styling capabilities as the Table Plus macro.

CSV is not a formal standard, but the best reference is The Comma Separated Value (CSV) File Format. The support in this macro comes close to following this pseudo-standard.  This macro supports Common table capabilities.

Feature Video

Include Page
Feature Video - CSV macro
Feature Video - CSV macro

Basic Use

This macro can be deployed using one of the following methods:

Selected from the Macro BrowserCSV (Comma Separated Values)
Markup Shortcut{csv}

Screenshot

Parameters

(info) Click a column heading to toggle the sorting of that column.

Table plus
highlightColor#ffffec
rowStylesbackground:#f0f0f0;color:#222;font-size:14px;border-bottom:black 2px solid;border-top:black 2px solid;,
stylebackground-color:white;
autoNumbertrue


Parameter
Default
Macro Browser Label
Description
outputhtmlOutput format

Determines how the output is formatted. Use wiki to have the data in the table rendered by the wiki renderer.

scriptmacro bodyLocation of CSV data

If a location of data is specified, the included data will follow the body data.

  • ^attachment - Data is read from an attachment to the current page.
  • page^attachment - Data is read from an attachment to the page name provided.
  • space:page^attachment - Data is read from an attachment to the page name provided in the space indicated.

Additional options available for Server only.

  • #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified.
  • global page template name - Data is read from a global page template. (info) Special note: How to deal with templates on Confluence 4.3 and later.
  • space:page template name - Data is read from a space template.
delimiter,Delimiter that separates columns
  • , (comma) - The default column separator.
  • whitespace - Blanks, tabs, and other white space are used to separate columns.
  • tab - A single tab character is used to separate columns.
  • blanks - Blank or blanks only.
  • pipe - '|'
  • other single character delimiter - may be within double quotes with some restrictions. Examples: ";" and "=" work. "|" does not.
quotedoubleQuote characterThe character used to represent quoted data. Quoted data may contain delimiters or new lines. Quote character data must be doubled inside a quoted string.
  • double - Double quote character: "
  • single - Single quote character: '
url
URL to CSV data Specifies the URL of a csv file. If specified, the included data will follow the body and script data. Use of this parameter may be restricted for security reasons. See your administrator for details.
user
URL user User name for URL access via basic authentication.
password
URL user password User password for URL access via basic authentication. 
timeout
URL connection timeoutAllows setting the wait time for URL access for slower connections. Time in milliseconds.
encoding
File encodingFile encoding for an external file if different from the system default handling. Since 4.1.0. Example: UTF-8More ...
columns
Columns to showComma separated list of column names or numbers in any order. Defaults to all columns in existing order. Columns are enumerated starting at 1.
ignoreTrailingBlankRowstrueIgnore trailing blank rowsA row is considered blank if all the columns selected by the column parameter are blank. Use false to show these blank rows.
showWikifalse

Show non-formatted version of  generated wiki

Use true to show a non-formatted version of the wiki table following the formatted table. This is used to help resolve formating issues. It can also be used to convert CSV to Confluence markup by cut and paste.
escapefalse

Escape special wiki characters

When wiki output is requested (output=wiki), some special characters (like '|', '[', ']', '{', '}') in data may cause undesirable formatting of the table. Use true to allow these special characters to be escaped so that it will not affect the formatting. The default is false so that data that has wiki markup will be handled correctly.
macrosfalse

Render wiki markup macros in body

Set to true to render wiki markup macros found in the body prior to processing as CSV. This is useful to run macros from SCRP, CCLI, SQL, or similar that can produce CSV output.
disableAntiXssfalseStop encoding of html charactersServer only. Set this parameter to true for csv tables that use output=html and have html content. Html content like <a href=http://google.com>google</a> will only display as a link if this parameter is enabled. Your administrator must grant specific users or groups to use this capability using Macro Security for Confluence.


Augment parameters

See Augments for details.

Common parameters

Include Page
info:_CommonTableCapabilitiesParameters
info:_CommonTableCapabilitiesParameters

Examples

Filter by label (Content by label)
showLabelsfalse
spaces@self
showSpacefalse
sorttitle
operatorAND
cqllabel = "example" and label = "csv" and space = currentSpace()
labelsexample,csv

Compatibility

  • Chart Macro - the CSV Macro can be used to create data for a chart
  • Beanshell Macro - can be used to generate csv macro and data as output from Java code (use output=wiki)
  • Groovy Macro - can be used to generate csv macro and data as output from Groovy code (use output=wiki)
  • Jython Macro - can be used to generate csv macro and data as output from Jython code (use output=wiki)

Other Macros

Below is a list of all other Macros available within this Add-on:

Filter by label (Content by label)
showLabelsfalse
spaces@self
sorttitle
typepage
cqllabel = "macro_home" and type = "page" and space = currentSpace()
labelsmacro_home

Additional References

Include Page_SupportFooter_SupportFooter