---
title: "Read/write SFTP server files (Sftp.x)"
slug: "readwrite-sftp-server-files-sftp"
status: "update"
updated: 2026-02-26T10:58:22Z
published: 2026-02-26T10:58:56Z
canonical: "support.lusid.com/readwrite-sftp-server-files-sftp"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Read/write SFTP server files (Sftp.x)

You can use the `Sftp.*` providers supplied by FINBOURNE to interact with files stored on a SFTP server.

Providing you have a suitable license and access control permissions, you can:

- Read from CSV, Excel, SQLite, XML, Parquet and plain text files stored on the SFTP server, perhaps in preparation for loading investment data into LUSID.
- Write to files of the same types, perhaps having retrieved investment data from LUSID.
- Search a folder or folders for files.
- Perform operations such as moving, copying, renaming and deleting files, including [directly to and from Drive](/v1/docs/readwrite-sftp-server-files-sftp#appendix-copying-files-directly-to-and-from-drive).

## Obtaining a connection string for your SFTP server

You must store location and credential details for your SFTP server in the [LUSID Configuration Store](/v1/docs/configuration-store). You then supply this information to a `Sftp.*` provider in the form of a *connection string*.

The following instructions are for the LUSID web app but you can use the [Configuration Store REST API if you like](/v1/docs/how-do-i-upload-information-to-the-configuration-store#using-the-configuration-store-rest-api):

1. Sign in to the [LUSID web app](https://www.lusid.com/app/home) as a user with administrative privileges.
2. Navigate to **System Settings > Configuration Store**, select the **Shared** tab, and click the **Add configuration set** button (top right).
3. In the **New set** dialog, specify a **Scope** of `Luminesce-Provider` and a **Code** of the form `Sftp-&lt;your-memorable-string&gt;`.
4. Click the **Add item** button four times to add keys with the names in the red box below, and supply appropriate values for your SFTP server.

For example: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/f2e6f8ef-4feb-4b80-b006-840d063431d0.png)

Your connection string is the **Code** minus the `Sftp-` prefix, so in this example `my-secure-sftp-server` (underlined in green above).

### Authenticating using a private key

To authenticate via a public/private key pair instead of a password, replace the `Password` key with `PrivateKey`.

If applicable, create an additional `PrivateKeyPassphrase` key:

![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-1759913846396.png)

You must provide the private key value in an RSA format. To convert a generated SSH key to RSA, run the following command:

```shell
ssh-keygen -p -m pem -f <path-to-ssh-key>
```

## Understanding access control permissions for the Sftp.* providers

You, and any other LUSID user wishing to run queries against a `Sftp.*` provider, must have suitable access control permissions. The general principle of creating policies for Luminesce providers, assigning them to roles and roles to users, is explained [in this article](/v1/docs/creating-policies-to-control-access-to-providers-for-different-luminesce-end-users). Note you should automatically have sufficient privileges if you are the LUSID domain owner with the built-in `lusid-administrator` role.

## Getting help for the Sftp.* providers

You can access the latest online help for `Sftp.*` providers by running a query like this:

```sql
@x = use Sftp.Csv
--help
enduse;
```

## Using the Sftp.* providers

The `Sftp.*` providers are very similar to the `Drive.*` providers for interacting with files in Drive, except you must provide a connection string encapsulating location and credential details for your SFTP server.

For the `Sftp.File` and `Sftp.File.Operation` providers, apply the connection string to the `Connection` parameter in the `where` clause of your query, for example:

```sql
select * from Sftp.File
  where Name like '%.csv'
  and RecurseDepth = 6
  and Connection = 'my-secure-sftp-server';
```

and:

```sql
@fileOperationsToPerform = select
  '/redundant.txt' as FullPath,
  'Delete' as Operation;
select * from Sftp.File.Operation
  where OperationsToPerform = @fileOperationsToPerform
  and Connection='my-secure-sftp-server';
```

For reading data using the `Sftp.Csv`, `Sftp.Excel`, `Sftp.Sqlite`, `Sftp.Xml`, `Sftp.RawText` and `Sftp.Parquet` providers, apply the connection string as the first argument to the `--file` option, separated from the file path by a colon, for example:

```sql
@x = use Sftp.Csv
--file=my-secure-sftp-server:/trade-files/equities/end-of-day.csv
enduse;
select * from @x
```

For writing data using the `Sftp.SaveAs` provider, apply the connection string as the first argument to the `--path` option, separated from the folder path by a colon, and the names of one file per input table using the `--fileNames` option, for example:

```sql
@data1 = select distinct TableName from Sys.Field order by 1;
@data2 = select distinct TableName, FieldName from Sys.Field order by 1,2;

@x = use Sftp.SaveAs with @data1, @data2
--path=my-secure-sftp-server:/trade-files/equities
--fileNames
start-of-day
end-of-day
enduse;
select * from @x
```

For lists of options and examples of other operations, see the documentation for the similar `Drive.*` providers below:

| **To interact with...** | **Read from using the ... provider** (links are to docs for similar `Drive.*` providers) | **Write to using the ... provider** (links are to docs for similar `Drive.*` providers) |
| --- | --- | --- |
| CSV and similarly-structured files | `Sftp.Csv` —> [Drive.Csv](/v1/docs/drivecsv) | `Sftp.SaveAs` —> [Drive.SaveAs](/v1/docs/drivesaveas) |
| Excel files | `Sftp.Excel` —> [Drive.Excel](/v1/docs/driveexcel) |
| SQlite files | `Sftp.Sqlite` --> [Drive.Sqlite](/v1/docs/drivesqlite) |
| XML files | `Sftp.Xml` —> [Drive.Xml](/v1/docs/drivexml) |
| Text files | `Sftp.RawText` —> [Drive.RawText](/v1/docs/driverawtext) |
| Apache Parquet files | `Sftp.Parquet` —> [Drive.Parquet](/v1/docs/driveparquet) |
| Find files | `Sftp.File` —> [Drive.File](/v1/docs/drivefile) | N/A |
| Move, copy, rename and delete files | N/A | `Sftp.File.Operation` —> [Drive.File.Operation](/v1/docs/drivefileoperation) (see also below) |

## Appendix: Copying files directly to and from Drive

You can use the `Sftp.File.Operation` provider to copy files to and from [LUSID Drive](/v1/docs/drive) in a single query, for example:

```sql
@fileToTransfer = select 
  '/Position_Details_20251128_TEST.xlsx' as FullPath,
  '/Implementation/Position_Details_20251128_TEST.xlsx' as NewFullPath,
  'CopyToDrive' as Operation;

select * from Sftp.File.Operation 
  where OperationsToPerform = @fileToTransfer
  and Connection='my-secure-sftp-server';
```

The full list of operations available for this provider is currently as follows:

- `Delete`
- `MoveRename`
- `MoveRenameMayOverwrite`
- `Copy`
- `CopyMayOverwrite`
- `CopyFromDrive`
- `CopyFromDriveMayOverwrite`
- `CopyToDrive`
- `CopyToDriveMayOverwrite`
