File Tools

Version: 1.6.23

Manipulating files through the file integrations API.

Connect File Tools with LogicHub

  1. Navigate to Automations > Integrations.
  2. Search for File Tools.
  3. Click Details, then the + icon. Enter the required information in the following fields.
    • Label: Enter a connection name.
    • Reference Values: Define variables here to templatize integration connections and actions. For example, you can use https://www.{{hostname}}.com where, hostname is a variable defined in this input. For more information on how to add data, see 'Add Data' Input Type for Integrations.
    • Verify SSL: Select option to verify connecting server's SSL certificate (Default is Verify SSL Certificate).
    • Remote Agent: Run this integration using the LogicHub Remote Agent.
  4. After you've entered all the details, click Connect.

Actions for File Tools

Inspect File

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

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

Name of the column containing the file to inspect.

Required

Output

A JSON object containing multiple rows of result:

  • 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.
15101510

Load .docx into a JSON Object

Load DOCX into JSON.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

A filename pointing to a .docx archive.

Required

Output

A JSON object containing multiple rows of result:

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

Load CSV into a JSON Object

Load CSV into JSON.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

Name of the column containing the filename/lhub_file_id to load.

Required

Header Names

If a CSV file will not have headers, provide a comma-separated list of headers to use.

Optional

Columns to Keep

If you only need specific columns, provide a comma-separated list of column names and the rest will be dropped from the results.

Optional

Output

A JSON object containing multiple rows of result:

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

Save Table as PDF

Save data of parent table into a PDF file.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Document Title

Title of PDF Document positioned at top center. Position can be customized using the Additional Options input below.

Optional

Header Row

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).
Example: <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>

Optional

Table Style Definitions

Table style definition.
Example: CSS stylings such as borders and padding.

Optional

@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;
}

Input Name

Description

Required

Per Row Template

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}}).

Required

<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>

Input Name

Description

Required

Orientation

Select Orientation Landscape/Portrait of the final PDF document. (Default is Portrait)

Optional

Additional Options

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.

Optional

  • 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

A JSON object containing multiple rows of result:

  • 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"
}
33603360

Save Table into CSV

Save data of table into a CSV file.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Include Hidden Fields

Include LogicHub hidden columns in the CSV output (default is True).

Required

Row Limit

Maximum number of rows to process. Warning: Exceeding the default of 100000 for very large tables can impact overall performance.

Required

Output

A JSON object containing multiple rows of result:

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

Parse EML/MSG File as Email

Parse an EML or MSG file and extract its contents.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

Name of the column containing the filename to load.

Required

Output

A JSON object containing multiple rows of result:

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

Read Text File

Read the contents of a text file.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

Name of the column containing the filename to load.

Required

Output

A JSON object containing multiple rows of result:

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

Download URL

Download an URL and return the resulting file ID.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

URL Column Name

The name of the column with the URLs that you would like to download.

Required

Output

A JSON object containing multiple rows of result:

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

Gunzip File

Gunzip a .gz file.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

Name of the column containing the filename to Gunzip.

Required

Output

A JSON object containing multiple rows of result:

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

Gzip File

Gzip a file.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

Filename Column Name

Name of the column containing the filename to Gzip.

Required

Output

A JSON object containing multiple rows of result:

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

Delete File

Delete the file by ID.

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

File Id Column Name

Column name from parent table that contains the ID of the file to delete.

Required

Output

A JSON object containing multiple rows of result:

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

Get Text From PDF

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

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

File ID Column Name

Column name from parent table that contains the ID of the file to read.

Required

Output

A JSON object containing multiple rows of result:

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

Get Text From Docx

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

Input Field

Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.

Input Name

Description

Required

File Id Column Name

Column name from parent table that contains the ID of the file to read.

Required

Output

A JSON object containing multiple rows of result:

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

Release Notes

  • v1.6.23 - Description changed in action Parse EML/MSG File as Email for input Name of the column containing the file Id to load.
  • v1.6.22 - Bug resolved in action Parse EML/MSG File as Email for encoding.
  • v1.6.21 - Bug resolved for file's data decode for invalid start byte.
  • v1.6.20 - Bug resolved for filename.
  • v1.6.19 - Bug resolved for JosnDecode.

Did this page help you?
© 2017-2021 LogicHub®. All Rights Reserved.