File Tools

Version: 2.0.7

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 NameDescriptionRequired
Filename Column NameName 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.
1510

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 NameDescriptionRequired
Filename Column NameA 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.
970

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 NameDescriptionRequired
Filename Column NameName of the column containing the filename/lhub_file_id to load.Required
Header NamesIf a CSV file will not have headers, provide a comma-separated list of headers to use.Optional
Columns to KeepIf 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.
700

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 NameDescriptionRequired
Document TitleTitle of PDF Document positioned at top center. Position can be customized using the Additional Options input below.Optional
Header RowProvide 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 DefinitionsTable 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 NameDescriptionRequired
Per Row TemplateJinja 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 NameDescriptionRequired
OrientationSelect Orientation Landscape/Portrait of the final PDF document. (Default is Portrait)Optional
Additional OptionsJSON 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"
}
3360

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 NameDescriptionRequired
Include Hidden FieldsInclude LogicHub hidden columns in the CSV output (default is True).Required
Row LimitMaximum 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
878

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 NameDescriptionRequired
Filename Column NameName 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.
752

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 NameDescriptionRequired
Filename Column NameName 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.
1508

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 NameDescriptionRequired
URL Column NameThe 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
1500

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 NameDescriptionRequired
Filename Column NameName 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
709

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 NameDescriptionRequired
Filename Column NameName 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
704

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 NameDescriptionRequired
File Id Column NameColumn 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
1650

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 NameDescriptionRequired
File ID Column NameColumn 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.
1788

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 NameDescriptionRequired
File Id Column NameColumn 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.
1470

Release Notes

  • v2.0.7 - Bug resolved in action Parse EML/MSG File as Email for URL pattern recognition.
  • 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.

© 2017-2021 LogicHub®. All Rights Reserved.