SQLite Forum

Feature request: .import based on column
Login
I'd like to propose `.import` based on column number.

```
--- Example file ---
Name          Address             Phone
John Doe      My street           555-1212
--------------------
```

For this example, `Name` is in column 1, `Address` in 15, and `Phone` in 35.

A command like

```
.import file table 1,15,35
```

would read each column starting at the corresponding column until next (minus one), or end of line (for the last one).

Leading and trailing spaces from each column should be trimmed in case of centered or right aligned fields.

---

When dealing with such data files (very common) I end up manually adding `|` (or other) column delimiter chars.

```
--- Modified file ---
Name          |Address             |Phone
John Doe      |My street           |555-1212
---------------------
```

This runs the risk of using a character already part of the data which will misread those rows.

One has to first check the file does not contain the delimiter character.  And, in rare cases, all printable characters are used.

Thank you for reading.

agp