SFTP folder + Naarvin: books from scheduled file exports

Connect an older or on-premise system by exporting Excel or CSV files to one SFTP folder. Naarvin reads the folder on a schedule, with the server key pinned.

3 min read
In short

For a system that can export files but offers no API, a scheduled export into one SFTP folder is enough. The files use Naarvin's template columns and are named after what they hold; Naarvin reads the whole folder on every sync, with the server's host key pinned and a user that can only read. Nothing on the server is changed.

What goes in the folder?

CSV or Excel (.xlsx) files with the same columns as the import templates, named by what they hold. Several files of one kind are read together, so a system can write one file a month.

File names Naarvin reads from the folder
File name starts withHolds
accountsThe chart of accounts
journal_entriesPosted journal lines
customer_invoices, vendor_billsOpen items, with credit notes
customer_invoice_lines, vendor_bill_lines (CSV)Lines with their VAT
customer_payments, vendor_paymentsPayments, with what is still on account
customers, vendorsMaster data with VAT numbers and terms
exchange_ratesDated rates
companies.csvCode, name, currency and country of each company

A file may be up to 50 MB, and one sync reads up to 250 MB in all. Files are streamed and cut off at their limit, whatever size the server reports.

Why does Naarvin read the whole folder each time?

Because the folder is the full picture of the books. An entry that is no longer in any file is marked deleted, which is how a reversal or a deleted entry in the source reaches Naarvin. Two safeguards apply: a folder with no journal file at all deletes nothing, and a sync that would remove more than half of what is loaded removes nothing and warns you instead. So keep every period's file in the folder, rather than replacing last month's with this month's.

Syncs run on the schedule you set, from every 15 minutes to weekly in your time zone, so set it to follow your export. Rows that fail the import checks are left out and listed as warnings.

How is the server connection protected?

  • The server's host key is pinned by its SHA256 fingerprint. Enter it when you connect; if you do not, the key the server shows the first time is recorded, and any other key later is refused until someone reconnects with the new fingerprint.
  • Naarvin signs in with a password or a private key (PEM or OpenSSH, with an optional passphrase), encrypted when saved and never shown again.
  • Give Naarvin a user that can only read the folder. Naarvin only lists and reads; it never writes, moves or deletes files.
  • The server must have a public address. Private and local addresses are refused.

Can one folder hold several companies?

Yes. Add companies.csv and a company code on each row, and each company links to its own company in Naarvin with the same currency. A folder for one company can leave both out and name the company code, currency and country on the connection. Rows in another currency carry their own exchange rate.

How do you set up an SFTP folder?

  1. Schedule the exportHave your system write the template files into one folder, named accounts…, journal_entries… and so on.
  2. Create a read-only SFTP userLimit it to that folder, and note the server's SHA256 host key fingerprint.
  3. Add the connectionEnter the server, port, folder, fingerprint and the user with its password or key, and the company details if there is no companies.csv.
  4. Run a full sync and compareCheck the trial balance against the source system's, and read the warnings before setting the schedule.

Questions people ask

Can we drop only this month's file each time?

No. The folder is read as the whole picture, so earlier periods' entries would look deleted. Keep each period's file in the folder; a sync that would remove more than half of what is loaded removes nothing and warns.

Does Naarvin delete files after reading them?

No. It only lists and reads. Clearing old files is up to you.

Can our bank use the same folder for statements?

Bank statements use their own folder, read into bank reconciliation. See [bank statements](/integrations/bank-statements).

Where Naarvin helps

See it on your own books

A guided demo on Demo Group's books, then we connect one of your companies. In Arabic or English.