I have table like this:

and a bunch of CSV files like this:

enter image description here

in per-patient directories.

Please note that I need to take a Patient field from path name and Date from file name (as you see).

What is the easiest way to import all data in one shot?

Please note that shell programming, sed and similar things do not scary me. If really necessary I can even overcome my deep revulsion to Visual Basic and the likes.


The CSV files you describe are not yet ready for insertion into a database. So first, write a script or use shell commands to create a single CSV file containing all records that need to go into the BloodTestResults table, reading the appropriate values from the path and filename.

Then open the CSV file with Calc and move it into Base as explained at https://help.libreoffice.org/Common/Importing_and_Exporting_Data_in_Base.

Another approach would be to write a Python-UNO macro to read the CSV files and execute SQL insert commands. I would recommend Python rather than Basic for this type of task because file handling and regular expressions are easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.