Writer classes

A FileWriteStep can be used with different Writers.

CSVWriter(filename[, header])

Write data to a comma-separated-values file.

ExcelWriter(filename[, header])

Write data to a new Excel (XLSX) spreadsheet file.

JSONWriter(filename, **kwargs)

Write data to a Javascript-Object-Notation file.

PPrintWriter(**kwargs)

A data writer class that prints() for testing purposes.

CSVWriter

class CSVWriter(filename, header=None, **kwargs)[source]

Write data to a comma-separated-values file.

__init__(filename, header=None, **kwargs)[source]

Create a new CSV writer instance.

Parameters
  • filename (str) – The filename to write the file to.

  • header (str) – What to write in the first row, can be ‘key’ or ‘label.de’ etc. or nothing.

  • dialect (csv.Dialect) – A csv writing dialect, defaults to csv.excel.

  • quoting (int) – A quoting method, one of QUOTE_MINIMAL (0), QUOTE_ALL (1), QUOTE_NONNUMERIC (2) or QUOTE_NONE (3), defaults to 2.

  • delimiter (str) – Overwrite dialect’s delimiter attribute, defaults to ';'.

  • quotechar (str) – Overwrite dialect’s quotechar attribute, defaults to '"'.

  • encoding (str) – Encoding to use when writing the file, defaults to 'utf-8'.

ExcelWriter

class ExcelWriter(filename, header=None, **kwargs)[source]

Write data to a new Excel (XLSX) spreadsheet file.

__init__(filename, header=None, **kwargs)[source]

Create a new Excel file writer.

Parameters
  • filename (str) – The filename to write our xlsx file to.

  • header (str) – What to write in the first row, can be ‘key’ or ‘label.de’ etc. or nothing.

  • sheet_name (str) – Sheet name in the generated Excel file.

JSONWriter

class JSONWriter(filename, **kwargs)[source]

Write data to a Javascript-Object-Notation file.

__init__(filename, **kwargs)[source]

Create a new JSON file writer.

Parameters
  • filename (str) – The filename to write the file to.

  • kwargs – Options to be passed down to json.dump()

PPrintWriter

class PPrintWriter(**kwargs)[source]

A data writer class that prints() for testing purposes.

__init__(**kwargs)[source]

Create a new Pretty-print writer.

Parameters

kwargs – Options to be passed down to pprint.pprint()