File Tools

Integration with LogicHub

Connecting with File Tools

To connect to File Tools following details are required:

  • Label: Connection name.

Actions with File Tools

Inspect File

Inspect the file and returns its MD5, SHA-1 & SHA-256 hashes, size, and MIME type.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: Name of the column containing the file to inspect.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: A JSON with the md5 hash, the size in bytes, and the mime-type of the file.

Load .docx into a JSON Object

Load DOCX into JSON.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: A filename pointing to a .docx archive.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: The content of the main xml document.

Load CSV into a JSON Object

Load CSV into JSON.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: Name of the column containing the filename/lhub_file_id to load.
  • Header Names: Optional. If a CSV file will not have headers, provide a comma-separated list of
    headers to use.
  • Columns to Keep: Optional. If you only need specific columns, provide a comma-separated list of
    column names and the rest will be dropped from the results.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: The content of the csv file.

Save Table as PDF

Save data of parent table into a PDF file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Document Title (Optional): Title of PDF Document positioned at top center. Position can be customized using the Additional Options input below.
  • Header Row (Optional): Provide an HTML table row item (maybe with custom HTML formatting) representing a header row. You can also provide a comma-separated list of headers to use (Default is parent table headers without any special HTML formatting). For example: <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>
  • Table Style Definitions (Optional): Table style definition (Example: CSS stylings such as borders and padding). For example,
@import url('https://fonts.googleapis.com/css?family=Lato:400,700');

table {
    border-collapse: collapse;
    font-family: 'Lato';
    font-weight: 400;
}

table th, table td {
    padding: 8px;
}

table th {
    font-weight: 700;
}
  • Per Row Template (Optional): Jinja templated HTML definition for each row. (Default is <tr><td>{{col1}}</td><td>{{col2}}</td><td>{{col3}}</td></tr>). Nested table is supported using <lhub_json_table> custom tag as: <tr><td><lhub_json_table>{{json_column}}</lhub_json_table></td></tr>. You can also use hidden columns like lhub_id or lhub_page_num here (provide it templated as {{lhub_id}}). For example:
<td>{{label}}</td><td>{{panel2}}</td><td>{{event_count}}</td><td>{{report_order}}</td><td><lhub_json_table>{{events}}</lhub_json_table></td><td>{{lhub_id}}</td>
  • Orientation (Optional): Select Orientation Landscape/Portrait of the final PDF document. (Default is Portrait)
  • Additional Options (Optional): JSON containing options like margin-bottom, margin-left, page-size (page-height or page-width for more fine grained control on page-size) for PDF.
    You can specify all wkhtmltopdf options. You can drop '--' in option name. If option without value, use None, False or '' for dict value.
{
    "page-size": "Letter",
    "margin-top": "0.75in",
    "margin-right": "0.75in",
    "margin-bottom": "0.75in",
    "margin-left": "0.75in",
    "encoding": "UTF-8",
    "no-outline": null
}

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • lhub_file_id: LogicHub File ID of PDF file.
{
    "has_error": false,
    "error": null,
    "lhub_file_id": "828f3c0063554d0395e9ed6cd8920314.pdf"
}

Save Table into CSV

Save data of table into a CSV file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Include Hidden Fields: Include LogicHub hidden columns in the CSV output (default is True).
  • Row Limit: Maximum number of rows to process. Warning: Exceeding the default of 100000 for very
    large tables can impact overall performance.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: File ID

Parse EML/MSG File as Email

Parse an EML or MSG file and extract its contents.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: Name of the column containing the filename to load.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: Result in JSON format.

Read Text File

Read the contents of a text file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: Name of the column containing the filename to load.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: Content of file.

Download URL

Download an URL and return the resulting file ID.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • URL COLUMN NAME: The name of the column with the URLs that you would like to download.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: File ID

Gunzip File

Gunzip a .gz file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: Name of the column containing the filename to Gunzip.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: File ID

Gzip File

Gzip a file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • Filename COLUMN NAME: Name of the column containing the filename to Gzip.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: File ID

Delete File

Delete the file by ID.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • File Id COLUMN NAME: Column name from parent table that contains the ID of the file to delete.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: Success/Failure

Get Text From PDF

Get the first 50,000 characters of text in the PDF file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • File ID COLUMN NAME: Column name from parent table that contains the ID of the file to read.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: Text from PDF file.

Get Text From Docx

Get the first 50,000 characters of text in the docx file.

Inputs to this Action

  • Connection: Choose a connection that you have created.
  • File Id COLUMN NAME: Column name from parent table that contains the ID of the file to read.

Output of Action
JSON containing the following items:

  • has_error: True/False
  • error: message/null
  • result: Text from docx file.

Did this page help you?