XLSX

Sender

This module implements a XLSX Worker

docker pull registry.goingrid.io/worker/xlsx:TODO

Table of Content

Properties

Data properties

Attribute Description
“*” “Content Read or Write to File, May contain Multi Values”

Control Properties

The following Controls are available for this module

Control Description
“filename” “Sets the Output filename when writeing to a XLSX File”
“sheetname” “Sets the Sheetname in the XLSX to write into “
“autoinc” “set to true or false, for append a new line insted of fixing the position”
“action” “If Start or Stop action is defined, this Control will be set “
“filesum” “Contains the Filesum of the current Input File beeing processed”

API

  • Poll changes from Directory and Scan for XSLX Files. Read the File and Parse it. Delete or Move it afterwards in to another Directory
  • Append Data or Create a new XLSX File.

Poll changes from file / dir

With this config

    -ServerURL "natspw@natsserver"
    -OutputChannel "debug_xslx"
    -Path "/tmp/transfer"
    -BackupDir "/tmp/backup"
    -ConfigFile "hive://xslx.config"

The files matched by the Input Pattern will be parsed and generate the following event:

Events from XLSX Import Config

Class: Echo
Operation: Debug
Control:
    filesum:
       safasfsdfa234f22f
    filename:
        import.xlsx
    action:
        data
Data:
    bookname:
       blubber
    author:
       naice

Configfile for Import

[
    {
        "_xlsxtype": "Some Comment we use in the config",
        "sheetname": "Importsheet",
        "class": "Echo",
        "operation": "Debug",
        "_sheetnumber": 0,
        "rownr": 3,
        "cols": [
            {
                "fieldname": "bookname",
                "colnr": 1,
                "whitelist": [],
                "blacklist": [],
                "regex": [
                    {
                        "search": "this",
                        "replace": "that"
                    }
                ]
            },
            {
                "fieldname": "author",
                "colnr": 2,
                "whitelist": [
                    ".+"
                ],
                "blacklist": [],
                "regex": [
                    {
                        "search": "(.*)fuu",
                        "replace": "($1)bar"
                    }
                ]
            }
        ]
    }
]

You can use sheetname or sheetnumber.
You can White or Blacklist Rows by adding Filter to whitelist or blacklist.
You can use regex to Search and Replace Content.

Export Data into a XLSX

With this config

    -ServerURL "natspw@natsserver"
    -InputChannel "write_xslx"
    -Path "/tmp/transfer"

And this Data

Class: XLSX
Operation: Write
Control:
    filename:
       myfilename
    sheetname:
       outputSheet
    autoinc:
      true
Data:
    B:
       blubber
       naice

This will append a new Row starting on Column B adding cells blubber and naice.

Class: XLSX
Operation: Write
Control:
    filename:
       myfilename
    sheetname:
       outputSheet
Data:
    B1:
       blubber
    D7:
       naice

This will write to B1 blubber and to D7 naice.

Service configuration

Like every other service, the log service includes all properties of the service configuration and since it listens on input the input configuration and also the output config.

In addition those are the following file service properties for the service:

Parameter Default value Description
“Path” "" “Path where the Inport or Export Files should be located”
“BackupDir” "/backup" “Path where the Imported Files should be moved to. If Import is done thr orig File will be deleted”
“CommandAttribute” "cmd" “Attribute name where we put commands into. The Worker will give start / run / stop in the command. For Pre or Post Jobs to be run on imports”
“InputPattern” ".*\\.xlsx" “Pattern of Files to Process (Regex)”
“ConfigFile” "xslx-config.json" “Config File for the XSLX Input Worker. See ConfigFile Section (Can use hive://…)”
“CheckInterval” 10 “Interval in Seconds to Scan the Directory”
“ConfigRequestTimeout” 10 “Timeout for Fetching Config from Hive”
“DoFileSum” true “Add a ‘filesum’ Attribute in the Document with the current File Filesum”
“StartAndStopClass” "XLSX" “Classname we send out StartAction / StopAction to. Adjust it to your needs”)
“StartAction” false “An Action name, we send our Start request to, suppressed if not set. This will be triggered at the start on a new File”
“StopAction” false “An Action name, we send our Stop request to, suppressed if not set. This triggers on the end of a import File”
“OutputFilename” "output.xlsx" “Name of the Default File we write into (use ‘filename’ as attribute to overwrite)”
“OutputSheetname” "Sheet1" “Name of the Default sheet we write into (use ‘sheet’ as attribute to overwrite)”