将excel工作表数据传输到mysql表 [英] transfer excel worksheet data to mysql table

查看:75
本文介绍了将excel工作表数据传输到mysql表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将excel工作表数据传输到mysql表?

解决方案

此代码适用于mysql-excel


= ================================================= = =====

将mySQL数据库表导出到EXCEL文件。

数据库表转储到WORD文档也可能。

展开 | 选择 | Wrap | 行号


作为一个敏锐的统计学家,他对时间的天气变化着迷(特别是与平衡潮汐变化有关)我在数字气象站获得了过去几年的全面天气数据。所有存档压力和温度读数都隐藏在Excel电子表格中 - 今年我实际上已经转移到Open Office作为我选择的电子表格。我终于决定是时候将一些数据移到我服务器上的MySQL数据库中,然后我可以操作数据在网络上显示。

首先我决定保留东西简单,通过GD库存储平均每日压力和温度以进行图形显示。在部分实验中,我上周末看了一下使用PHP命令Shell实现传输的选项。

首先,我尝试使用ODBC为Microsoft Excel驱动程序和SQL创建系统DSN提取数据。内置的ODBC PHP函数非常直观,脚本构建起来非常简单。然而,解决方案太专有,因为我必须首先使用MS Query为所需列建立字段名称并同步查询本身:

展开 | 选择 | 换行 | 行号


< blockquote>

展开 | 选择 | Wrap | 行号

how to transfer excel worksheet data to mysql table?

解决方案

this code is for mysql-excel

================================================== ======
export a mySQL database table to an EXCEL file.
database table dump to WORD document possible also.

Expand|Select|Wrap|Line Numbers


As a keen statistician with a fascination for weather variation over time (in particular in relation to equilibrium tidal variations) I have acquired comprehensive weather data over the past few years from my digital weather station. All the archive pressure and temperature readings are tucked away in Excel spreadsheets - this year I have actually moved over to Open Office as my spreadsheet of choice. I finally decided it was time to move some of this data into a MySQL database on my server, where I could then manipulate the data for display on the web.
To start with I have decided to keep things simple, storing average daily pressure and temperature for graphical display through the GD library. In part for experimentation, I had a look last weekend at the options for achieving the transfer using the PHP Command Shell.
Firstly I tried using ODBC by creating a System DSN for the Microsoft Excel Driver, and SQL to extract the data. The inbuilt ODBC PHP functions are fairly intuitive and the script was quite simple to build. However the solution was too proprietary since I had to first use MS Query to establish the field names for the required columns and synchronising the query itself:

Expand|Select|Wrap|Line Numbers


Expand|Select|Wrap|Line Numbers


这篇关于将excel工作表数据传输到mysql表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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