As in topic, how to import .txt file
Your question could be a bit more definitive. Not clear as to what type of data is in the file. Also as to just connecting to it or creating an actual database table with it and then what database is to be used.
For connecting to it, see the LibreOffice Base documentation here → LibreOffice Base Guide. Chapter 2 - Creating a Database, has a section called
For actually creating a database table, get the text file data into a Calc spreadsheet. From there you can copy/paste into Base as a table. Again refer to the documentation in Chapter 3 - Tables. See section
Importing data from other sources.
- You can connect a database document to a directory of equally structured text files. (File->New–>Database, connect to existing, type:Text). This will be read-only and good enough for many purposes such as mail merge, filtering, sorting, effortless import to Calc and Writer.
- You can link a text file to a virtual table in a relational database. Details depend on the type of database. In case of HSQLDB: [Tutorial] Using csv/text files as editable data source. (View topic) • Apache OpenOffice Community Forum
In case of 2) you may need to import all columns as text and then let a view convert strings to dates, times, numbers etc.