Skip to content

/table

The /table endpoint accepts requests containing either CSV or JSON data and converts it to a plain text table.

Warning

The Content-Type header must be sent with each request. Use text/plain for CSV data and application/json for JSON.

Request Body

The body of the request should contain the data to be converted. This will either be a string of CSV or JSON data. For example:

Pokemon,Type,Number
Venusaur,Grass,3
Charizard,Fire,6
Blastoise,Water,9
Pikachu,Electric,25
[
    {
        "Pokemon": "Venusaur",
        "Type": "Grass",
        "Number": 3
    },
    {
        "Pokemon": "Charizard",
        "Type": "Fire",
        "Number": 6
    },
    {
        "Pokemon": "Blastoise",
        "Type": "Water",
        "Number": 9
    },
    {
        "Pokemon": "Pikachu",
        "Type": "Electric",
        "Number": 25
    }
]
{
    "Pokemon": {
        "row1": "Venusaur",
        "row2": "Charizard",
        "row3": "Blastoise",
        "row4": "Pikachu"
    },
    "Type": {
        "row1": "Grass",
        "row2": "Fire",
        "row3": "Water",
        "row4": "Electric"
    },
    "Number": {
        "row1": 3,
        "row2": 6,
        "row3": 9,
        "row4": 25
    }
}

Table Parameters

table-tablefmt

Specifies which flavour of plain text table to convert to.

Info

Accepts: string
Default: simple

Example

/table?table-tablefmt=github

The available options are:

  • plain
  • simple
  • github
  • grid
  • fancy_grid
  • pipe
  • orgtbl
  • jira
  • presto
  • pretty
  • psql
  • rst
  • mediawiki
  • moinmoin
  • youtrack
  • html
  • unsafehtml
  • latex
  • latex_raw
  • latex_booktabs
  • latex_longtable
  • textile
  • tsv

For a full list of examples see Table Format Examples.

table-numalign

Override the default column alignment for columns identified as containing integers.

Info

Accepts: string
Default: right

Example

/table?table-numalign=center

The available options are:

  • right
  • center
  • left
  • decimal
  • none (disable alignment)

table-stralign

Override the default column alignment for columns identified as containing strings.

Info

Accepts: string
Default: left

Example

/table?table-stralign=center

The available options are:

  • right
  • center
  • left
  • none (disable alignment)

table-disable-numparse

By default, all values which can be parsed as an integer are converted (e.g. "1" is converted to 1). Use this option to disable this behaviour.

Info

Accepts: bool
Default: false

Example

/table?table-disable-numparse=true

table-floatfmt

Define custom number formatting applied to all columns containing decimal numbers.

Info

Accepts: string
Default: none

Example

/table?table-floatfmt=.4f

CSV Parameters

The following URL query parameters are available to manipulate CSV data.

csv-sep

The delimeter to use when parsing CSV data.

Info

Accepts: string
Default: ','

Example

/table?csv-sep=|

csv-delim-whitespace

Specifies whether or not whitespace (e.g. ' ') should be used as the delimiter when parsing CSV data. Cannot be used with csv-sep.

Info

Accepts: bool
Default: false

Example

/table?csv-delim-whitespace=true

csv-header

Row number to use as the column names. Specify none if your CSV data does not have a header row and each column will use its index as a header value instead.

Info

Accepts: int, none
Default: 0

Example

/table?csv-header=none

csv-prefix

Prefix to add to column numbers when no header values are provided (i.e. when using csv-header=none).

Info

Accepts: string
Default: None

Example

/table?csv-header=none&csv-prefix=col

csv-names

List of column names to use. If the CSV data contains a header row you should include csv-header=0 to override the column names. Duplicates in this list are not allowed.

Info

Accepts: list
Default: None

Example

/table?csv-header=0&csv-names=column12,column13,column14

csv-usecols

Return a subset of columns from the original data.

Info

Accepts: intlist
Default: None

Example

/table?csv-usecols=0,2,4

csv-skipinitialspace

Skip spaces after delimiter when parsing CSV data.

Info

Accepts: bool
Default: false

Example

/table?csv-skipinitialspace=true

csv-skiprows

A list of line numbers to skip (0-indexed) or the number of lines to skip at the start of the file.

Info

Accepts: intlist, int
Default: None

Example

/table?csv-skiprows=25
/table?csv-skiprows=1,23,45

csv-skipfooter

Number of lines at bottom of file to skip.

Info

Accepts: int
Default: None

Example

/table?csv-skipfooter=5

csv-keep-default-na

Whether or not to include the default NaN values when parsing the data.

Info

Accepts: bool
Default: True

Example

/table?csv-keep-default-na=false

csv-skip-blank-lines

If True, skip over blank lines rather than interpreting as NaN values.

Info

Accepts: bool
Default: True

Example

/table?csv-skip-blank-lines=false