Import tool Excel CSV

試著忘記壹切 提交于 2020-01-02 09:19:12

问题


I need an import tools for a web app. I've been looking around and found some, just not sure about their stability. I'm using the Zend Framework for part of the project and was hoping I could find an import tool there, since I already have the framework, but couldn't see one...am I looking in the wrong place?

I would like the web users to be able to import csv, excel files into a mysql database. I'd like the tool to allow the users to select the columns of the spreadsheet/csv to match up to the database columns if possible. For the exporting side I'm leaning to using jasper reports to export a dataset to csv,excel...is this a good/bad idea?

Are there some tools free or commercial tools that you have used and would recommend, to allow me to incorporate this feature into my website?

Thanks.


回答1:


For import:
Try MySql's built-in csv import: LOAD DATA INFILE

LOAD DATA INFILE 'yourdata.csv' INTO TABLE tbl_name
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n';

For export:
Try the jQuery plugin: table2csv. It converts an HTML table into a CSV file. Use the argument, delivery:'value', to return the csv as a string.

Here's an example implementation. I know it's in C#, but there's only a little code involved. It would be easy to port to PHP.



来源:https://stackoverflow.com/questions/2262343/import-tool-excel-csv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!