Skip to content

Mergefiles

flowtask.components.MergeFiles

MergeFiles

MergeFiles(loop=None, job=None, stat=None, **kwargs)

Bases: FlowComponent

MergeFiles

Overview

The MergeFiles class is a component for merging multiple files into a single file or dataframe. It supports various
file formats, including CSV, Excel, and HTML, and handles encoding detection and conversion as needed.

.. table:: Properties :widths: auto

+------------------+----------+--------------------------------------------------------------------------------------------------+
| Name             | Required | Description                                                                                      |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| filename         |   No     | The name of the merged output file.                                                              |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| file             |   No     | The file object to be merged.                                                                    |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| filepath         |   No     | The directory path for the merged output file.                                                   |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| ContentType      |   No     | The content type of the files being merged, defaults to "text/csv".                              |
+------------------+----------+--------------------------------------------------------------------------------------------------+
| as_dataframe     |   No     | Boolean flag indicating if the result should be returned as a dataframe, defaults to False.      |
+------------------+----------+--------------------------------------------------------------------------------------------------+

Return

The methods in this class manage the merging of files, including initialization, execution, and result handling.



Example:

```yaml
MergeFiles:
  ContentType: application/vnd.ms-excel
  model: worked_hours
  pd_args:
    skiprows: 6
  as_dataframe: true
```

close async

close()

close.

close method

run async

run()

run.

Run the connection and merge all the files

start async

start(**kwargs)

start. Start connection.