Direct csv import into Base table

Lionel Elie Mamane lionel at mamane.lu
Mon Jun 3 03:39:27 PDT 2013


Hi,

Would you mind if I included the developer's mailing list in CC in our
discussion?

On Mon, Jun 03, 2013 at 12:05:56PM +0200, Zolnai Tamás wrote:

>    I'm working on a new feature in Base again. It's just a little
> user helper feature to make available the direct import of an csv
> file into table, without open Calc and copy&paste the content from
> it to Base.

Base can already do that without resorting to Calc:

1) Menu File / New / Database

2) Connect to existing database / Text

3) Fill in needed configuration

3) Open the just created .odb file in window 1

4) Open the destination .odb file in window 2

5) Drag'n drop (or copy/paste) from window 1 to window 2.

And it works for any supported database type, not only CSV, as long as
the destination database driver supports SDBCX (that is, table
creation).

If you intend to put an easier / faster / ... UI on this procedure,
sure, that seems nice.

> already have the plan to implement it and it seems to me that it
> will work not just with csv files but all Calc compatible format (in
> this case only the first sheet will be imported, but later it can be
> extended).

This starts to look like you want to reimplement a different way to
achieve the same as the above, and not only slap a different / better
UI on it. Unless there is a good reason (which one?), I'd rather
not. Two implementations = more code, two sets of bugs, confusion for
the user, ...

Note that the above works "for any calc compatible format" by using
"Spreadsheet" instead of "Text". And many other sources...

Again, slapping a better UI on it, that would e.g. avoid the need to
create an .odb file which the user will delete right after, would be
nice. I imagine it would work like this: reuse the database wizard
open existing database and "connect to existing database" stuff to
setup a SDBC URL, but do *not* create a .odb file connecting to that
URL. Instead, connect to that URL in code, list the tables, ask the
user which tables to import, and import them into the current
database. Bonus points for reusing the same codepath as a paste in the
the copy/paste case (one time for each table).

> I will use up the code which lies under the OLE-object feature of
> Writer, which already contains the csv import.

Why would that be any better than what I outlined above?

>    The only question is where this feature would be reachable. I have two
> ideas and I think all of these two places should be used:
>    1. Table view -> "Tasks". Add a 4th option like "Import Table From
> File...". This point contains all other places which are almost the
> duplicates of this "Tables" list (e.g. Insert menu with label "Table
> (Import)..." ).
>    2. Table view -> "Tables" -> context menu. The label can be "Import
> Table...".

The context menu does not make that much sense to me, unless we *also*
add the other tasks to it (and then also in Queries, Forms and Reports).

-- 
Lionel


More information about the LibreOffice mailing list