V
V
Viktor2015-02-15 00:16:08
PHP
Viktor, 2015-02-15 00:16:08

How to import large xlsx into MySQL?

Good evening.
There is the following task from the customer: once every 1-2 weeks, some managers receive an email with an Excel file that contains 60k lines. Customer history or something.
These managers at some point take out a tablet and want to filter this file by customer number. They don’t understand anything and they need to make a page with one input where they would drive in the client’s number and receive a selection for this client from this xlsx file in the desired format (pdf / xlsx / csv or just text in the mail in the form of a tablet) .
The customer said to do this - when a letter arrives with a file, he takes and copies the file to a folder and calls the URL by which the import into the database takes place. For example site.ru/import. After that, you can go to the site.ru landing page and request a selection from the database.
That is, if it’s normal, then I would make a filter in the Excel file by the client number or something like that (I don’t sit in Excel myself). But they want to do it via the web.
The site will be hosted with 180 seconds max_execution_time and 256 MB for PHP RAM. I tried to improtit through PHPExcel, one parsing takes a couple of minutes. Maybe, of course, I'm setting something up wrong, but anyway, it seems to me that inserting another 60k rows into the database will take a long time.
The only option that comes to mind is to run cron, which would import in parts, somewhere to make a table in which to store how much has already been imported or something like that. Well, let him import 10 minutes (for 10 calls).
What is the best way to do all this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2015-02-15
@SagePtr

There's XML inside, wrapped in a ZIP, so by any means necessary to parse the XML.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question