Auto Import Mysql from XSLX - php

I have datas that will be added monthly, every month I must import more than 30 XSLX! When I am using Navicat I must set the relation from xslx column with mysql table column and I do it repeatedly! It's wasting my time ...
I was wondering that I can import from xlsx to MYSQL automatically, using PHP or Navicat or anything else maybe? Please help me.
SOLVED :
I am using SimpleXLSX, it's faster and efficient. Very recommended for everyone!

You can write simple Perl script that will do the following:
Open your Excel file(s) for reading using DBD::Excel driver.
Open MySQL server connection using DBD::mysql driver.
Read data from Excel using SELECT and insert data into MySQL using INSERT.
Profit! :-)
To make it work on Windows, you should install following free software:
Activestate Perl from http://activestate.com/perl, then DBD::mysql and DBD::Excel as follows:
ppm install DBD::Excel
ppm install DBD::mysql
And finally, you need to write your Perl script. It should not be very difficult if you follow documentation on links above.

I would go for PHPExcel
Good examples and docs are supplied.

Try Data Import tool in dbForge Studio for MySQL.
Customize data import once and save template file (import options, field mapping and etc.), then use it many times. It is also possible to use data import in command-line mode.

Related

working with php and python together

currently i am working on a project which is related to automation.
I am using php and mysql for my work. I have to make a code in php which can import, export and edit the excel file and the extension of excel file is .xlsm. As i have tried my best, but i didn't succeed with the .xlsm file.
so, one of my friend has suggest me that in python, you can do that.
so, is it possible, if i insert the python script(which can import, export and edit the .xlsm file) into the php code and the run the code. please let me know, will this work. if this work then how?
You can use exec() to execute an external program in PHP.

php export excel file

I am woking on exporting datas to excel file from mysql.I google some docs and finally I choose the PHPExcel,it works well and I can successfully complete my work.
but when I upload my code to the online server,it display an error which is "XMLWriter is not found",I also google for this and I know it because the installed php isn't compiled with the class "XMLWriter ",but the question is I have no privilege to recompile the php source.
so if there is other open source class that is used to export data to excel file?
I hope I describe my question clearly.
If you can avoid using PHPExcel, have a look at this tutorial for a plain and simple solution, it might help.
Since you have no control on your PHP installation, I strongly suggest you to abandon PHPExcel, as your PHP version does not include the needed libraries for this package and you don't want to go though painful hacks to make it work somehow...

SQL imports missing tables

I am doing the export from Magento database on one instalation via phpMyAdmin, and I have tried exporting it in .sql and in tar.gz.
When I import that database in another instalation, I get no errors but there are tables missing, so I have only half of the tables and I see that after letter L (log_visitors table) there are no tables.
Its very strange, could someone give me idea what is it about?
On my version of phpMyAdmin, there is a checkbox with the following text on the Import page:
Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. (This might be good way to import large files, however it can break transactions.)
Make sure that checkbox is unchecked (by default it is checked), else it may be causing your problem.
So we turned on the "enclose in transaction" and "disable foreign keys" checkfields on phpMyAdmin while exporting, and also seperated export in two .sql files. It worked.
Note that the problem wasnt standard php timeout or standard phpMyadmin limitations on uploading big files, as we previousuly also tried bigdumb and ssh commands for import and it didnt worked.
As #Willem stated, you could have that option checked when you import the sql file.
But if you're still not be able to import it after unchecking that option, this means that the file you are importing is too big.
In this case you can use the mysql command line utility, if you have SSH access to your server or you can try bigdump, a php script that let's you import a database splitting the SQL query in chunks!
Hope it helps :)

How to create a MSEXCEL file using PHP

Good day,
How do i create an msexcel file using php script?
I have already prepared my data in a well structured array. I need
to be able to format my array into tables in msexcel.
the server where the WAMP server is running has no MS Office installed, would it
affect my objective to create the msexcel file. do i need to install on msoffice
in the server in case? fyi, i dont actually need to save the excel file in the server
but can be an option too.
thanks.
This is really a spin on DaveRandoms comment.
Make a CSV and set the mimetype to any of the ones in this SO question.
That way Excel (or any equivalent application) will start and show the file.
The PHPExcel library will let you take your data and write it into a valid Excel file, whether you need old-style XLS or new style XLSX format.
You don't need to have Excel installed on the server to use it.

Writing MS Access .MDF files with PHP

Is it possible to write .MDF files using PHP. I have a simple HTML table - x columns, y rows that I wish to convert into a MS Access dataset. There are no foreign keys or anything exotic, just a number of rows and columns.
I have Google searched but the only advice I seem to be able to find is to save it as a .CSV. Unfortunately this isn't acceptable for my client. They want to simply be able to double click the icon and have the database load up in Access (Seems you have to import csv files and can't just double click them).
Those are actually two different problems:
1) Parsing HTML to separate values
Since you seem to have found a way to export to csv, I won't be answering this. You already got your parser then.
2) Create an mdb file.
You can use odbc to talk to Access, that is, if you are in Windows. That means that PHP must be installed on a Windows machine. I'm not aware of any Linux drivers for Access..
You can use odbc_connect to connect to the database:
$conn = odbc_connect("dbname","" ,"");
From there, working with the database is pretty similar to MySQL as long as you use the ODBC functions.
The only problem is creating the actual MDB. This cannot be done in ODBC, you'll need the JET engine. It may be possible to create an MDB file from PHP, but it may be easier to create an empty MDB once, and copy that file from PHP whenever you need a new database.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.
http://jackcess.sourceforge.net/
But an MDF file is not a standard Access file extension. MDB and MDE are while MDW is for user level security.
Have not tested this but this might help you:
http://devzone.zend.com/article/4065
Note that active development of MDB Tools has moved from Sourceforge to Github
https://github.com/brianb/mdbtools

Categories