Although the process is not as automatic as you might think, the fact is that it is simple and can save you a headache or two. Let’s go.
How to export from MariaDB table to Calc / Excel?
I imagine that you already have a database with one (or several) tables. If not, then you have to create one.
In my case, I didn’t have a table at hand and I used a MySQL data generator. You can use anyone.
What we have to do is to set up a query within the table and export it to a form that we can import in either Calc or Excel. This statement can be any statement that returns results.
So, first generate the results you want. In my case, it is a simple SELECT, but I repeat it can be whatever you want.
sudo mysql -u root -p
SELECT * FROM Student;
In my case, I got
Now that you know which statement to use, exit from the console
And from the system, execute this command
sudo mysql -u root -p [database] -e "[query]" -B > output.csv
In my case, I executed the following
sudo mysql -u root -p Sample -e "Select * from Student" -B > export.csv
Once you enter the password, the process will be done.
When you have the file ready, then import it with Calc.
Look at the result
As you can see, the result is excellent.
Calc is a great alternative to Excel, but occasionally, we need data from it that comes from MySQL or MariaDB. Now you know how to do it in a quick and easy way.