Automate file transfers¶
Fetch files on a schedule, load their rows into a database, and move or archive the processed files.
- Trigger on a schedule
Add a Schedule component as the source and open its scheduler. Choose Poller to run every n milliseconds, or Once, Daily, Weekly or Monthly with a start and end time. You can limit how many times it runs. - Fetch the file
Use Sftp or Ftp withTransferMethodset toGetFiles. Set the remote and local paths and a file filter such as*.csv. - Read the rows
Use FileIn on the local folder. SetFileProcessMethodtoSequentialto send one message per line, orDocument(withReturnFileContents) for the whole file. - Load the database
Write rows with SqlUpdate or SqlProcedure, or load whole files fast with SqlBulkCopier. - Move the processed file
On FileIn, setProcessAfterto move the file into an archive folder (FileMovePath), so it isn't processed twice. - Alert on failure
Add Error links to an Smtp component.
FileIn settings¶
| Property | Purpose |
|---|---|
IncomingPath, ExtensionFilter |
Folder to read and which files, for example *.txt |
FileNameExpression |
Read specific files named in the incoming message instead of scanning the folder |
FileProcessMethod |
Sequential (line by line) or Document (whole file) |
UseHeaderForStore |
Use the first line as names for the fields |
ProcessAfter, FileMovePath, FileMoveName, OverwriteMoveFile |
Leave, delete or move the file after reading |
Encoding |
Default iso-8859-1 |
Ftp and Sftp settings¶
| Property | Purpose |
|---|---|
HostName, port, UserName, Password |
The server and credentials. Sftp supports password authentication only, not SSH keys. Store the password encrypted in the Common Store. |
TransferMethod |
GetFiles or PutFiles; Sftp also has DeleteFiles to remove remote files older than DeleteFileDays |
RemotePath, LocalPath and file names |
Where to transfer. Filters: *, name*, *name, *name*. |
RemoteMovePath, DeleteSource, DeleteRemote |
What happens to the source after transfer |
NumberOfRetries, RetryInterval (Ftp) |
Retry when the file isn't there yet |
ControlFileName, ProcessBefore (Sftp) |
Wait for a control file, or move files first, so half-written files aren't transferred |
TransferType / TransferConversion |
ASCII or binary, and line-ending conversion between Windows and UNIX |
Excel¶
To write to Excel, use MsOffice: set cells with A1={Data(1)}, formulas with a # prefix (C2=#SUM(A1:A10)), insert a text file into a worksheet with InsertText, and run macros.