client.files.get_preview

A method of the Files endpoint.

get_preview(id: int, *, column_delimiter: str = None, include_header: bool = None) Response

Get a column and row preview of a file

API URL: GET /files/{id}/preview

import civis
client = civis.APIClient()
response = client.files.get_preview(...)
Parameters:
idint

The ID of the file.

column_delimiterstr, optional

The column delimiter for the file. One of “comma”, “tab”, or “pipe”. If omitted, the delimiter will be auto-detected.

include_headerbool, optional

Whether the first row of the file is a header row. If omitted, header presence will be auto-detected.

Returns:
civis.Response
  • columnsList[civis.Response]

    The columns detected in the file.

    • namestr

      The column name.

    • sql_typestr

      The detected SQL type of the column.

  • rowsList[List]

    A preview of rows from the file. When a header row is present it is reflected in “columns” and excluded from this array.

  • column_delimiterstr

    The column delimiter for the file. One of “comma”, “tab”, or “pipe”. Null when the file is empty.

  • include_headerbool

    Whether the first row of the file is a header row.