1

I want to know whether phpExcel library can create and upload the file directly to s3 without creating the temporary files, or in the case of large files a multipart upload is possible. Currently with the reference from enter link description here I am using the code

$writer->save("s3://" . $exportBucket . "/" . $keyname);

I want to write directly to s3 because after writing 2000 rows with 50 column's memory exhaust error is getting, Also I want to continuously generate more than 15 files same time.

Rosa Mystica
  • 243
  • 1
  • 3
  • 17

1 Answers1

3

No, it isn't practical to write directly to s3. Excel files are not written in a linear fashion, so the writer needs to be able to use seek() and even the aws stream wrapper for s3 doesn't support that.

ALthough this "Store PHPExcel files in Amazon S3" indicates that it can work with some minor modification to PHPExcel

And writing directly to s3 won't reduce memory usage anyway.

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • I am newbie to php excel so I don't know it is a valid doubt, Will it possible to save the temporary file created I mean during the cell creation directly to s3 so that writing on the stream we can reduce the memory overhead right. – Rosa Mystica Dec 04 '17 at 05:39
  • @RosaMystica - No it isn't possible.... if it was, we'd be doing that already; taking that approach wouldn't save any memory at all, because the file still has to be built in its entirety to save it, and it would add an enormouse slowdown to running a script – Mark Baker Dec 04 '17 at 08:03