Android Question [Solved] Converting csv file to db file

Shelby

Well-Known Member
Licensed User
Hi All,
I've wasted lot of time trying to find a workable tool to covert a larger than the original database edited Excel worksheet csv file into a db file for my SQLite project. I've tried Klaus's tool at https://www.b4x.com/android/forum/threads/csv-to-sqlite-program.87061/ but it's too advanced for me to use. I've tried the fishcode tool suggested by Rboeck at https://fishcodelib.com/DBMigration.htm and I didn't succeed there either. I've tried the google solution from sqlitetutorial.net. I simply want to convert my edited Excel csv file>.db by renaming the existing db file and replacing it in my project files folder. What can I do? Thanks
P.S. my project compiles fine and here it is.

Help me Obie One Klausnobie (Star Warrior)
 

Attachments

  • SS2021 - Copy.zip
    1.8 KB · Views: 253
Last edited:

Shelby

Well-Known Member
Licensed User
Now I'm trying your program Klaus......... This program: Convert .Net Free (Non-Commm.....v9.7.7671.3. Wait, I guess that might not be it either. I'll try downloading it again.
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
When I extract the contents of your zip folder(17.6KB), I see a B4a Object Browser. I click it and I see no Load CSV button Now I'll try the smaller zip folder.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, but I do not understand what you are doing.
I downloaded the zip file from this thread: https://www.b4x.com/android/forum/threads/csv-to-sqlite-program.87061/
And the zip file CsvToSQLite.zip is the B4J project.
And the CsvToSQLiteExe.zip is an exe file, the stand alone program generated with Build Standalone Package.
This is the image of the program !

1612370542581.png
 
Upvote 0

Shelby

Well-Known Member
Licensed User
The smaller zip file extracts to display an application icon which will not activate when clicked. The application is called J CsvToSQLite. It will not activate. Maybe it will work now. I'm trying: run as administrator. Nope! It still did not activate.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
As I explained in the CsvToSQLite thread, on my computer with the McAfee antivirus, the program is rejected. Maybe it is the same on your computer.
Do you have the B4J IDE installed on your computer?
If yes use the B4J CsvToSQLite.b4j project.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
I have a different antivirus (Eset Nod32) perhaps that's what you are getting at; my antivirus is a stopper? I have recently downloaded B4J so maybe I can drag your icon onto the B4J after the B4J is activated?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Can't drag it and can't get the B4J to see it when I use File>Open
Since you continue to have problems using klaus's convert although, not hard at all, if you want to post your csv file and I am sure someone will be able to convert it for you with DB Browser to a table in a database with the same version you have. If your file is a good csv file, DBBrowser will handle it
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Thanks Mahare, an error I got said that my comma delimited file was read only. Perhaps my saving was strange, giving read only? But that error was with the DB Browser I think. My plan is to continue to edit my database adding records, etc., with an excel csv file. Consequently, I need to master this converting of my excel csv file to a db file, rather than continuing to ask for help. New: When I look at the properties of the csv excel file, the file is not a read only file.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
You say that you downloaded B4J.
1. Did you install it?
2. Can you run the B4J IDE, the same way as B4A?
3. Can you create a simple B4J project with the B4J IDE?
4. If yes, you have downloaded the CsvToSQLite B4J project and unzipped it in a folder.
5. Simply, run the B4J IDE and load the CsvToSQLite.B4j project from the folder where you unzipped the project, like you do when you load a B4A project in the B4A IDE.

I do not understand what you are trying to do with dragging?
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
OK I loaded it and now I'll run it but where will it display and be ready for me to load my csv file? I guess I'll find out. Running now; it seems to be running ok. I'll just try to find where the db file saved.
When I click convert, I can't tell where the db file might be. Also, when I click convert, the converter disappears and in the IDE logs it displays an error in the logs....first lines:

Error occurred on line: 174 (Main)
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "Table": syntax error)
at org.sqlite.DB.newSQLException(DB.java:383)
at org.sqlite.DB.newSQLException(DB.java:387)

And so on
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
When you load a csv file in the CsvToSQLite program, the bd file is saved in the same folder!
As already suggested by Mahares, post your csv file and I will convert it with the CsbToSQLite program to see if there is any problem.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
OK, here it is...wait, this window and the attach files link won't accept CSV files. I'll kee trying.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
The uploaded file does not have an allowed extension. The following extensions are allowed: .zip, .txt, .pdf, .png, .jpg, .jpeg, .jpe, .gif, .apk, .bal, .bas, .jar, .xml, .java, .b4xlib, .b4xtemplate
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Maybe I need to zip it. I'll try that. 7-zip wouldn't work; I had to use "send to compressed (zipped) folder"
 

Attachments

  • Table List IRC2 saved from CSV.zip
    7.3 KB · Views: 138
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
Maybe becasue I've been editing my csv excel file I'm producing a problem. Perhaps I should edit my simple excel workbook and after editing it, convert it to csv before converting the csv file to a db file.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Here is my newly converted excel csv file. It still won't covert for me in your B4j converter.
 

Attachments

  • Table List 2 21.zip
    7.3 KB · Views: 148
Upvote 0
Top