Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial phpExcel导出(大数据报错)

phpExcel导出(大数据报错)

Jun 23, 2016 pm 01:49 PM
phpexcel Tarsus Export Report an error

数据量:
列:155
行:10000(后续数据量可能上涨150倍)

前提:
1、因为这1w行的标题存在较为复杂的逻辑问题,所以需要合并单元格的操作,只能选择excel导出
2、原系统导出时,发现会内存溢出,程序崩溃,实际中不可能无限制的修改内存。所以从网上查找了资料,有两种方法,一种是追加(写一个excel,后面的去读取这个excel,然后追加),另一种是多sheet

问题:
1、根据方法做了测试,只是查了这10000个基本数据(没有涉及到原先的多表关联),发现追加的数据量过了500临界点之后程序就崩溃了(内存为php默认的内存),多个sheet也无法解决,难道追加也和内存有关系么?难道数据量超过了限制?有什么方法可以解决这个问题?或者有什么方法可以解决这样的大数据导出?
(需要考虑用户体验。。。)


回复讨论(解决方案)

导成 csv 吧,这个比较容易一些,或者导成 xml 格式,但是文件名可以写成 xls 。

不过,一下子导出150W 行数据,有人看吗?

客户要这么多数据,应该是要别的工具做统计

csv有合并单元格,字体样式的操作么?

导成 csv 吧,这个比较容易一些,或者导成 xml 格式,但是文件名可以写成 xls 。

不过,一下子导出150W 行数据,有人看吗?




客户要这么多数据,应该是要用别的工具做统计(总是各种需求..)

csv有合并单元格,字体样式的操作么? 


导成 csv 吧,这个比较容易一些,或者导成 xml 格式,但是文件名可以写成 xls 。

不过,一下子导出150W 行数据,有人看吗?




客户要这么多数据,应该是要用别的工具做统计(总是各种需求..)

csv有合并单元格,字体样式的操作么? 

对了,最主要的是这个excel里面有超连接,连接到服务器上用资源管理器查看非结构化数据,如果csv估计不行了吧?

这个可能对你有用  http://www.baidu.com/s?wd=phpExcel%E7%BC%93%E5%AD%98&ie=utf-8



导成 csv 吧,这个比较容易一些,或者导成 xml 格式,但是文件名可以写成 xls 。

不过,一下子导出150W 行数据,有人看吗?




客户要这么多数据,应该是要用别的工具做统计(总是各种需求..)

csv有合并单元格,字体样式的操作么? 

对了,最主要的是这个excel里面有超连接,连接到服务器上用资源管理器查看非结构化数据,如果csv估计不行了吧?

存在 xml  格式的吧,可以解决 超连接和 合并单元格式的需求 。 

你自己建一个excel 文件,随便录几个数据,再存在 xml 格式,你大概看看,没什么难度。

数据不要一次读出来,可以分页多次遍历追加csv或者exel

全部到处150W,excel的临界点都超过了,肯定不现实的。

PHPExcel 处理Excel的确有很多问题(不知道是不是自己没搞懂), 按document操作经常出现内存不够,或者CPU高飙的情况。数据量一大基本没法操作。
之前参考了几种修改其缓存的方法,对我来说没什么用。你可以参考下。PHPExcel缓存方式 http://pqbd69.blog.163.com/blog/static/2312720062013865360908/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Exporting songs downloaded from QQ Music as mp3 on mac only requires two steps Exporting songs downloaded from QQ Music as mp3 on mac only requires two steps Jan 05, 2024 pm 07:10 PM

Listening to music is a very common thing, I believe many friends will do it no matter where they are. What software do you usually use to listen to music? Do you use QQ Music like me? I currently use QQ Music to listen to songs, and it can be used not only on mobile phones, but also on Mac computers. In addition to listening to songs online, we can also download our favorite songs from QQ Music to the computer. However, the songs downloaded from QQ Music for Mac are not in the format we need. What we need is music in MP3 format. So how to export the songs downloaded from QQ Music for Mac to MP3 format? How to export and convert songs downloaded from QQ Music for Mac to MP3 format? If you want to export and convert songs downloaded from QQ Music for Mac to MP

How to get Douyin private message emoticons on WeChat? How to export the private message emoticon package? How to get Douyin private message emoticons on WeChat? How to export the private message emoticon package? Mar 21, 2024 pm 10:01 PM

With the continuous rise of social media, Douyin, as a popular short video platform, has attracted a large number of users. On Douyin, users can not only show their lives but also interact with other users. In this interaction, emoticons have gradually become an important way for users to express their emotions. 1. How to get Douyin private message emoticons on WeChat? First of all, to get private message emoticons on the Douyin platform, you need to log in to your Douyin account, then browse and select the emoticons you like. You can choose to send them to friends or collect them yourself. After receiving the emoticon package on Douyin, you can long press the emoticon package through the private message interface, and then select the "Add to Emoticon" function. In this way, you can add this emoticon package to Douyin’s emoticon library. 3. Next, we need to add the words in the Douyin emoticon library

Cause analysis: HTTP request error 504 gateway timeout Cause analysis: HTTP request error 504 gateway timeout Feb 19, 2024 pm 05:12 PM

Brief introduction to the reason for the http request error: 504GatewayTimeout: During network communication, the client interacts with the server by sending HTTP requests. However, sometimes we may encounter some error messages during the process of sending the request. One of them is the 504GatewayTimeout error. This article will explore the causes and solutions to this error. What is the 504GatewayTimeout error? GatewayTimeo

Solution: Socket Error when handling HTTP requests Solution: Socket Error when handling HTTP requests Feb 25, 2024 pm 09:24 PM

http request error: Solution to SocketError When making network requests, we often encounter various errors. One of the common problems is SocketError. This error is thrown when our application cannot establish a connection with the server. In this article, we will discuss some common causes and solutions of SocketError. First, we need to understand what Socket is. Socket is a communication protocol that allows applications to

How to export xmind files to pdf files How to export xmind files to pdf files Mar 20, 2024 am 10:30 AM

xmind is a very practical mind mapping software. It is a map form made using people's thinking and inspiration. After we create the xmind file, we usually convert it into a pdf file format to facilitate everyone's dissemination and use. Then How to export xmind files to pdf files? Below are the specific steps for your reference. 1. First, let’s demonstrate how to export the mind map to a PDF document. Select the [File]-[Export] function button. 2. Select [PDF document] in the newly appeared interface and click the [Next] button. 3. Select settings in the export interface: paper size, orientation, resolution and document storage location. After completing the settings, click the [Finish] button. 4. If you click the [Finish] button

How to export the cross-section diagram in Kujiale_How to export the cross-section diagram in Kujiale How to export the cross-section diagram in Kujiale_How to export the cross-section diagram in Kujiale Apr 02, 2024 pm 06:01 PM

1. First, open the design plan to be processed in Kujiale and click on the construction drawings under the drawing list above. 2. Then click to select the full-color floor plan. 3. Then hide the unnecessary furniture in the drawing, leaving only the furniture that needs to be exported. 4. Finally, click Download.

Step-by-step guide to quickly solve pyqt5 installation errors Step-by-step guide to quickly solve pyqt5 installation errors Jan 19, 2024 am 09:32 AM

If you are learning Python and want to develop GUI applications, PyQt5 is a very good choice. It is a bound version of the PyQt library under Python, which makes it very convenient to call and develop the Qt graphics library. However, sometimes you may encounter some problems when installing PyQt5. This guide will provide you with some steps to quickly solve installation error problems, and also attach specific code examples. Make sure the Python version is correct PyQt5 is a Python-based library, so first

Golang compilation error: How to solve undefined function error Golang compilation error: How to solve undefined function error Nov 25, 2023 am 08:59 AM

Golang compilation error: How to solve undefinedfunction error Overview: Go language is a statically typed programming language, and the compiler will check for errors in the code during the compilation phase. One of the common compilation errors is "undefinedfunction", which means that when using a function, the compiler cannot find the definition of the function. This article will describe some common causes of this error and provide solutions. Function not imported: The most common situation is when we use an

See all articles