Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export sqlite into CSV using RSqlite?

Tags:

csv

How to export sqlite into CSV using RSqlite? I am asking because I am not familiar with database files, so I want to convert it using R. It may be very simple, but I haven't figure out.

like image 814
Frank Wang Avatar asked Apr 01 '26 21:04

Frank Wang


1 Answers

not quite sure if you have figured this out. I am not quite sure how to do it within R either but it seems pretty simple to export to csv using SQLite itself, or by writing out csv from the database you have loaded to R.

In SQLite, you can do something like this at your command prompt

>.mode csv
>.export output.csv
>.header on
>select * from table_name;
>.exit 

SQLite will automatically wrote out your table to a output.csv file

like image 119
Bhoom Suktitipat Avatar answered Apr 03 '26 16:04

Bhoom Suktitipat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!