Reputation: 117
I have written some Python code that scrapes information and puts it into several different excel files depending on what the data is. Usually around 8 separate excel files.
I am wanting to be able to have this data automatically load into a database.
I believe that Python automatically comes with the SQLLite database installed?
I found this post: Load CSV data into MySQL in Python
which seems to be similar to what I want to do. However, I have never used SQLLite and don't even know how to tell if it is installed on my machine to begin doing any testing. Is there an easier way to load in data than using SQLite?
Once confirming SQLite is installed, the first step it seems would be to create the database and then try to load the data into it, making sure it appends data correctly so things don't get overwritten.
Eventually I want to be able to connect to the database via excel so that It will automatically generate information when I want it.
Thanks.
Upvotes: 0
Views: 137
Reputation: 186
I think you should keep using CSV instead of calling it excel. To integrate with excel you need to work with COM interop, which will be a huge story.
If you already have pandas, then the best route is probably just use pandas to connect to SQLLite since you already have code written to save to csv.
Working with SQLite Databases using Python and Pandas
Upvotes: 1
Reputation: 1
As i understand you have to install SQLLite using this site [https://www.sqlite.org/download.html]
And then install the python package - sqlite3 and use this below code to connect to your database Here is one more link about using python to insert data in sqllite enter link description here
import sqlite3 conn = sqlite3.connect('test.db') print ("Opened database successfully")
Upvotes: 0
Reputation: 35
Sqlite is an extension on mozila or chrome, it is simple to use as a database. I think it will be a suitable solution for you as beginner. First, you have to install the extension for chrome from here : https://chrome.google.com/webstore/detail/sqlite-manager/njognipnngillknkhikjecpnbkefclfe?hl=en
Second: I would highly recommend following this tutorial: https://www.youtube.com/watch?v=ebYMbi_0Www&list=PLQjJhFzhbHlAYWuHE-P-gC0FRwKn6cCDK
Upvotes: 0