Advanced Database – Link external data to a database: text
For this tutorial, we are going to create a text file in LibreOffice Writer.
Open LibreOffice Writer.
Enter the text shown. The first line designates field names, separated by commas. Each new line represents a new record with fields in the same order as the top line.
Select Save As from the File menu.
Name the file and set Save as Type: to ‘Text (.txt)(*.txt)’
Exit writer and open a new database in LibreOffice Base.
In the wizard, select Connect to and existing database -> Text
Click Next.
Click Browse in the ‘Set up a connection to text files’ section.
Select the folder that contains the text file we created.
Click OK.
Click Next.
Select to register the database and open it for editing.
Click Finish, name the database and click Save.
The database will automatically open for editing.
Go to the Tables section and double-click the table with the same name as the text file as we created.
Notice that the table has been populated with the text that was saved in the document.
As the database is connected to the text file, you cannot add tables directly to the database.
To add a table, create a new LibreOffice Writer file and add some data in the same format as previously.
Save the file in the same folder as the previous text file (it must be the same folder for it to work).
Exit Writer and re-open the connected database file.
As the database is linked to the folder, the text file we just created will automatically create an identical table.
We can also add or edit the records within these text files and it will automatically update the database.