search

Home  >  Q&A  >  body text

python - How to solve the problem when the browser is half stuck when exporting excel with more than 10,000 items?

Business requirements sometimes require tens of thousands of items to be exported.
Can I use python to process it?? It’s too stuck.
What if I use python to process it?

習慣沉默習慣沉默2728 days ago2025

reply all(13)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-14 10:51:44

    More than 10,000 items are not a lot. You can use the third-party library PHPExcel. Or directly export csv, function: fputcsv .

    reply
    0
  • 代言

    代言2017-06-14 10:51:44

    If you want to export, just export it directly to CVS mode.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-06-14 10:51:44

    You don’t need to export it all at once. Export in batches

    reply
    0
  • 三叔

    三叔2017-06-14 10:51:44

    Time-consuming server tasks like this should not be designed as Browser->Sync->Server;
    should be in the form of asynchronous tasks:

    1. Browser: I want an Excel, please generate it for me first

    2. Server: OK, the mission has started

    3. Browser: Let me refresh it and see (you can use a long connection instead), it seems to be completed. Give me the URL (URL can be reflected in the task, no need to obtain it again), I want to download it

    4. Server: http://domain.com/test.xlsx

    5. Browser: Start download

    reply
    0
  • 学习ing

    学习ing2017-06-14 10:51:44

    Isn’t it enough to have more than 10,000 entries? How big is the file?

    reply
    0
  • 三叔

    三叔2017-06-14 10:51:44

    You can make the generation segmented... write 1000 items in 1000 items.
    In addition, if php times out, you can change set_time_limit()

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-06-14 10:51:44

    Asynchronous, all export operations should be made asynchronous

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-06-14 10:51:44

    Written in paging, for example, refresh once every 1000 items

    reply
    0
  • 学习ing

    学习ing2017-06-14 10:51:44

    Use the script to run, php -f export.php

    reply
    0
  • 为情所困

    为情所困2017-06-14 10:51:44

    Use asynchronous or multi-process, the browser submits the task, prompting that the task is being processed, the background multi-process script slowly processes it, and when it is completed, it pushes a message to the browser to prompt the user that the export operation has been completed and can be downloaded.
    Browser push message: http://www.workerman.net/web-...
    Multi-process framework: http://doc3.workerman.net/ins...

    reply
    0
  • Cancelreply