Import DBase Files error

I’m trying to open DBF files using LibreOffice Build ID: 1:6.4.7-0ubuntu0.20.04.1. It gives me an “Import DBase Files” dialog to pick the character set. I’ve tried both “Western Europe (Windows-1252/WinLatin 1)” and “Western Europe (ASCII/US)”. Then it gives:
General Error.
General input/output error.

Windows users open these files with Excel just fine. I’m stumped and am would love any advise.

TIA

Hard to tell without a sample DBF file causing the issue in your environment (which btw. is known to have many strange side effects, if LibreOffice has never been completely deleted, including autoremove, and reinstalled)

These or this? It may be only this file is corrupted.

Quick test, if your LibreOffice reads dbase: The example Bibliography-Database is actually a dbase-File. You may check if the datasource is available and can be read. You may also open the file directly with calc.

I’m accessing dBase Files from my archive often, so there is usually no problem with LibreOffice.

If you upload a sample of the problematic Dbase file, a more accurate diagnosis is possible.

All the DBF files contain proprietary data that I can’t share.

We tried four different DBF files, and all give the same result.

Where can I find the example Bibliography-Database?

Thanks

What dBase version was the file stored in? On Linux maybe the file command could tell.

In your user profile (probably ~/.config/libreoffice/4/user) the database/biblio/biblio.dbf

Note that you have to have the libreoffice-base (or whatever it’s called in Ubuntu) package installed to import .dbf files.

Please note this file ( biblio.dbf) contains Memo fields (biblio.dbt). Specify UTF-8 encoding when opening.
Due to Memo, there may be problems opening this file in Excel.

On Windows, biblio.dbf is located in the installation directory, typically "C:\Program Files\LibreOffice\presets\database\biblio"

I was absolutely wrong when I assumed I had the entire LibreOffice suite installed. :blush: Terribly sorry.

A final question, any way to eliminate the “Import DBase files” prompt to select the Character set (e.g. set a default)? They should always be the same.

The last selection is remembered, so if it’s really always the same just click OK. The dialog can’t be bypassed.

Can if you open file with a macro. :slightly_smiling_face:

' Open Dbase file. Returns object corresponding to opened document.
' - fileURI  Path to file (URI format).
' - encoding File encoding. Use "0" for the system character set. If missed or empty then "76" (UTF-8).
Function OpenDbaseFile(Byval fileURI As String, Optional ByVal encoding As String)
 Dim props(2) as new com.sun.star.beans.PropertyValue
 If IsMissing(encoding) Then encoding=""
 If encoding="" Then encoding="76"
 props(0).Name="FilterName":    props(0).Value="dBase"
 props(1).Name="FilterOptions": props(1).Value=encoding
 props(2).Name="ReadOnly":      props(2).Value=True
 OpenDbaseFile=StarDesktop.loadComponentFromURL(fileURI, "_blank", 0, props())
End Function

Sub TestDBase
  Dim v
  v=OpenDbaseFile(ConvertToUrl("C:\Program Files\LibreOffice\presets\database\biblio\biblio.dbf"))
End Sub
2 Likes

A lot of dBase-Files come without an identifier for the used charset, so LibreOffice asks - like .csv-Files.
But if the identifier is set, LibreOffice will read the File without further questions. I remember patching my inherited archive of dbf-Files.

Edit:Byte 29
https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm

Edit2: Table with language ids found here
https://www.clicketyclick.dk/databases/xbase/format/dbf.html
Be aware, there are more recently generated dbase files around, wich may even contain unicode. So you have to find out, what fits your need.

1 Like

My app receives 1-2K ZIP files daily from our Windows team, and each ZIP contains 5 DBF files. On a bad day, I’ll have to open 10-20 of those 5-10K DBF files. The Windows team is unable/unwilling to do anything with the DBF files, so I’ll probably have to just live with the extra click.

Thanks everyone

And wich charset is used?
I’m pretty sure, it is possible to patch the byte under linux.

But maybe sokol92 suggestion if using a macro may be easier to implement.

And there is a third possibility: If you define a dbase datasource you can put all .dbf-files in the folder and may access them from there. But I have to check, where to set the charset for this.

Of course, all this can be done with macros (the example above is executed without a request). LO can process Zip archives (without subdirectories) using standard tools.
If you post an example of such archive with “approximate” data and describe what should be in the final result, then you can be helped.

The DBF files all contain proprietary data that I can’t post.

The character set I’m using is “Western Europe (Windows-1252/WinLatin1)”.

Here’s the process I go thru:

  1. Double-click on a ZIP in a 3rd party app. The app opens the ZIP in Archive Manager. Presumably the app downloads the ZIP from a remote system to a temp location, and then opens it.
  2. I click on one or more of the DBF files listed in Archive Manager
  3. The DBF files open automatically with Libre Office, although I have the confirm the “Import DBase files” dialogue first.

I was looking for a way to have LIbre Office skip that import dialogue. I’m skeptical that any work-around will be more streamlined. I don’t want to make the open process more of a hassle.

Thanks