将Excel数据获取到数据库-初学者 [英] Getting excel data into Database - beginner

查看:40
本文介绍了将Excel数据获取到数据库-初学者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一些Python代码,这些代码可根据信息的内容将信息抓取并放入几个不同的excel文件中.通常大约有8个独立的excel文件.

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.

我相信Python会自动安装SQLLite数据库吗?

I believe that Python automatically comes with the SQLLite database installed?

我发现了这篇文章:将CSV数据加载到Python中的MySQL

这似乎与我想要执行的操作类似.但是,我从未使用过SQLLite,甚至不知道如何判断它是否已安装在我的计算机上以开始进行任何测试.有没有比使用SQLite更简单的方法来加载数据?

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?

一旦确认安装了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.

最终,我希望能够通过excel连接到数据库,以便它会在需要时自动生成信息.

Eventually I want to be able to connect to the database via excel so that It will automatically generate information when I want it.

谢谢.

推荐答案

我认为您应该继续使用CSV而不是将其称为excel.要与excel集成,您需要使用COM interop,这将是一个巨大的故事.

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.

如果您已经有熊猫,那么最好的方法可能就是使用熊猫连接到SQLLite,因为您已经编写了保存到csv的代码.

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.

使用Python和Pandas处理SQLite数据库

这篇关于将Excel数据获取到数据库-初学者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆