Direct csv import into Base table

Lionel Elie Mamane lionel at
Mon Jun 3 07:07:44 PDT 2013

On Mon, Jun 03, 2013 at 02:57:47PM +0200, Zolnai Tamás wrote:
>> 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:

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

> The usability of this method is the same as which I mentioned. Have to
> open an other window and use copy&paste (additionally make a useless file).
> So yes, my primary aim is to add an easier way.

>>> 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 didn't know about this feature up to now, but for the first blush
> it is not the same feature, at least from the users point of
> view. As I see these connection is a readonly access to a bunch of
> csv/text files (or sheets of one spreadsheet file) with openning an
> alone database to them.

Whether the access the source is read-only or read-write depends on
the underlying driver; for CSV it is probably read-only, be it only
for lack of a primary key. For DBaseIII, for example, I think it is

But Read-only access to the source is all you need for import, so I
don't quite get the point in the current discussion.

> The feature which I intend to implement is making a new table and
> insert into the already opened database.

Yes, which is exactly what the procedure described in my previous mail
also does. Except it is not limited to CSV and other calc-supported
formats (but any supported database), and already gives you access to
each sheet of a calc file instead of the first.

Which was my main motivation for slapping a better UI on *this*
procedure rather than on the more limited "go through Calc" route.

> With this I just say that for the user it can be looked as a
> different thing and so not make confusion.

Well, if "drag'n drop" and "import" of the *same* data behave
differently in the *same* application (that is, Base), I think this is
confusing and unpredictable: even if the user knows of these two ways,
why would he expect one to work "better" or "different" than the

> Implementation is an other part. Of course I will look up the code
> of this connection thing and reuse all the usefull code. But the
> implementation which I planed is not means real new code, but
> intentse use of UNO API.

Once you have a SDBC URL, the rest of the work is also completely
through the UNO API: I expect in

I expect that the existing code path used when copy/pasting from one
Base file to the other uses pretty much these APIs.

> The Writer OLE-object feature (...) the same file import as Calc do
> (...) which more usefull than the page with the same aim in
> Base. More usefull means more options and a table showing the
> expected result.

Well, if the CSV setup screen in Base sucks, we can fix
*that*. Possibly even use the same setup screen than in Calc? As in:
merge the two.

If you do that (additionally to the easier Base import UI), you'll
have enhanced not only "import into new base file" but also "connect
to CSV directly", which is used e.g. by Writer's mail merge, as well
as by Base. I.e. it has broader appeal / applicability for our users.

IMO, having a "import into any database from any database" feature is
also more broadly useful than only "import into any database from a
Calc-supported file". So I'd prefer we had the former; I don't think
it is essentially more difficult, but I agree that for the specific
case of CSV, enhancing Base's connect UI to match Calc's open UI *is*
definitely an additional work.

CSV seems to be more important for you than "all other database
formats", I don't know why <shrug>. From a broader perspective, I
would regret that Base has a more restricted-to-CSV "import"
functionality (rather than "import from any database, including CSV")
only to marginally better serve the CSV case in the short term.

>>>    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).

> It comes in my mind just because the commonly used method is the
> copy&paste

You mean "copy&paste from Calc". Is it? It would not have occurred to
me to do a Calc-to-Base copy&paste rather than a Base-to-Base

Anyway, there is another idea for "how to make this feature

1) Open a file manager

2) Open the LibreOffice window where you want to import the data.

2) Drag-n-drop the file into the LibreOffice window.

This currently works for a Calc window, but not for a Base window. I
think it would be amazing if additionally to the tasks pane, drag'n
drop worked.


More information about the LibreOffice mailing list