In Base, is it possible to import or past data into a table?
I have been able to create an odb file from the csv file but it is linked to the csv file and I do not want it linked to the csv file.
Is there no way to easily populate a table with existing data?
Many possible solutions:
-
You have created a Base file connecting to a folder for *.csv-files? Then create another Base file connecting to internal HSQLDB or Firebird. You could drag and drop or copy with right mouse click tables from the Base-CSV to the Base-HSQLDB (… if you aren’t using LO 7.4.5.1 or earlier versions of LO 7.4, bug 153003)
-
You will use the *.csv-file directly in a database file. This has to be an internal HSQLDB. You could connect a text table to the *.csv-file, could write data in this *.csv-file …
-
You are connecting with Base from an external database server like MariaDB. You could copy the content of a *.csv-file directly by SQL. Some databases will include special commands for this.
-
If you get many *.csv-files with the same structure you could use a macro for importing the data.
So you have decide what is “easy” for you.
Thank you for the options. I will definitely keep them in mind!
From what I have been able to figure it only works when pasting data from a Calc spreadsheet that has been copied.
This works for me.
But if there are other solutions, I would be interested in learning about them.
Since csv is not a standard and each database engine has different means to import text, Base does not offer any tool other than copy&paste from spreadsheet. If you imported the text correctly into Calc, LibreOffice is able to read row by row, cell by cell and tell numbers from text.
In order to do this without Calc, everything depends on 2 things:
- Which type of database are we talking about? See status bar of your Base document.
- All the tiny details of the csv to be imported. Post a typical line of data.
It’s reasonable to use the calc wizard but it should be enabled to run from base, even if calc is hidden behind the scenes.
Here are 2 lines from one of the csv files:
ID,State,Code,Country
0,Badakhshan,BDS,Afghanistan
This comes from another database, right? The ID number is generated by that other database. If the database is on the same network, just connect a Base document to it instead of using 2 different databases.
If the other database is not connectable, the question remains:
This came from a downloaded csv file from a website. I want to create a form where the user provides their address information. I want them to input the apartment, street no., and street name, and then select the country they are in which will provide them with a listing of the provinces or states within their country, after which they will be presented with a list of the cities within the selected province/state, they will then select the city and if it is not there are able to add it. Most of the information required for the table(s) is available on the web and downloadable as a csv file.
Paste or import everything from various sources onto a spreadsheet.
Arrange the columns.
Fix errors, inconsistencies and missing data.
When everything matches the criteria of your own database, copy the collected data from the spreadsheet into the database.