Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 19:55
    alessandrotesoro starred box/spout
  • Jan 31 2019 19:40
    Maxeee09 starred box/spout
  • Jan 31 2019 19:05
    metallurgical starred box/spout
  • Jan 31 2019 13:04
    barryvdh commented #624
  • Jan 31 2019 11:48
    rn1000 starred box/spout
  • Jan 31 2019 11:04
    kruglikdenis starred box/spout
  • Jan 31 2019 10:28
    gjportegies starred box/spout
  • Jan 31 2019 09:06
    guanhui07 starred box/spout
  • Jan 31 2019 08:44
    JingwenTian starred box/spout
  • Jan 31 2019 04:28
    absalomedia starred box/spout
  • Jan 31 2019 02:03
    brnmonteiro starred box/spout
  • Jan 31 2019 02:01
    kaishuizhuyu starred box/spout
  • Jan 31 2019 01:30
    OHOM starred box/spout
  • Jan 31 2019 00:51
    cherryred5959 starred box/spout
  • Jan 31 2019 00:50
    yanghaifeng88 starred box/spout
  • Jan 30 2019 21:43
    barryvdh edited #624
  • Jan 30 2019 21:22
    barryvdh edited #624
  • Jan 30 2019 21:20
    barryvdh commented #616
  • Jan 30 2019 21:19
    barryvdh opened #624
  • Jan 30 2019 21:16
    barryvdh commented #612
Jean Santos Silva
@jean07ss
Guys, its possible format cell value to string? My cell have "falso" and "verdadeiro" and give me wrong values when I try to get them
43pranay
@43pranay
Hello, I have the CSV file with a size 157MB it contain around 900000 rows and when I iterate the rows my system were crashed/hang,
markosko
@markosko
@43pranay whats your code?
43pranay
@43pranay
I simply copy the code as it is from documentation and replace the file and just ran it on the localhost. It shows 20 to 30 rows of data and loading.... then crashed
markosko
@markosko
Without code hard to say or whats in file as if you badly written code it can crash from out of memory
43pranay
@43pranay
you can find code here: https://codeshare.io/OdWXXN
one more thing how do get particular cell value
markosko
@markosko
u cant :D u would need to get row by row and at certain row stop and retrieve value
@43pranay hard to say but it can crash cause of showing all info about cells in row and crashes cause of time limit maybe
43pranay
@43pranay
Is there another way to retrieve all 900000 rows, I just want to store one column value into the database
2 replies
// don't forget to change the path!
require_once '[PATH/TO]/src/Spout/Autoloader/autoload.php';
Is above line mandatory, I just want to implement on laravel
biense
@biense

I am now using spout v3.3.0, where using
$filePath = "file.xlsx";
$writer = WriterEntityFactory::createXLSXWriter();
$writer->openToFile($filePath);
..... I put some data in the rows etc.
$writer->close();'

gets the file downloaded in the public folder of my app. However, I want to set the http headers in such way the file will be downloaded to a local folder by the user of the app, not to the server. I can't seem to find how to do this in the docs. A reference to the how to would be nice, or if anyone has tips on the matter would be great too! Should I change the $filePath, or give other params to openToFile()?

markosko
@markosko
use this $writer->openToBrowser($outputFileName) for downloading to pc
markosko
@markosko
@biense :point_up:
biense
@biense
@markosko Thanks!
biense
@biense
I've added individual styling to cells. The styling works, however, the headers are removed. Even when I add an extra row manually with the header titles as values (With their own styling), only an extra blank line is added. Does this already ring bells, where something is going wrong? Let me know, I can grab and drop some code later if needed.
biense
@biense
Still not sure why the above happened, now iterating through the first item of the array one time extra and using the keys to make the headers, so its solved for now:) Cheers!
Sergey Ivanov
@Serganbus
Hi there!
Anyone know how to create selectable cell with box/spout? As I see, it's not provided in code. May be I'm wrong?
markosko
@markosko
how u mean selectable ? kind of dropdown ? @Serganbus
markosko
@markosko
in case yea, u could only write your own xml for it if i remember correctly
Sergey Ivanov
@Serganbus
@markosko thanks, will try it.
jean-marie leroux
@jmleroux
Hello guys,
I there still a maintainer to review pull requests for this repo? I think @adrilo moved from Box and I don't see many reviews on PRs since a few weeks/months.
1 reply
kostas
@trichask
Hello guys!
Is it possible to create a cell at a given index/letter? For example is it possible to do the following:
$cells = [3 => 'Value',  4 => 'Value 2'], or $cells = ['D' => 'Value',  'E' => 'Value 2']
kostas
@trichask
To answer my own question: It is possible by using the Row@setCellAtIndex method.
Example:
$row = WriterEntityFactory::createRow();
$cell = WriterEntityFactory::createCell('Carl');
$row->setCellAtIndex($cell, 2);
$writer->addRow($row);
Ian Wellock
@NightIsland

One of my big problems with Spout is inconsistency. If I read a CSV, I get String cells, and I can write code to handle them. But if I read an XLSX, I might get all String cells, or some might be Date cells, etc., and then I have to be aware of completely different values like a Datetime etc.

Can anyone suggest a way to modify the Spout code so that it doesn't try to do this conversion? I just want it to pass me the raw data in text format and let me deal with it.

10 replies
Einar
@eigan
There is some great PRs waiting (formula, merging, date cells). Does anyone know of an up-to-date fork of spout with these?
Kunal Am
@kambasana_gitlab
Does spout support excel cell comments when importing
p1xel007
@p1xel007

Is there any function where I can define the Laravel Query and spout will handle the rest? I'm using spout for import in a job and it works great.

Now trying to implement export.

How to deal with large export?

I know storing all the rows from Query in variable will consume a lot of memory, so I was thinking about chunking the query and mapping over each row from the query.

Will that work?

1 reply
Zeit42
@Zeit42
Hello! Who can I reach with regards to security re: PHP Version?
11 replies
ackoDotDev
@ackoDotDev
Hello, is there any example of batching or just simple if($row < $batchSize) is enough?
richdear
@richdear
How can I read excel line by line. I want to write wrapper around box/spout ex: Excel.nextRow()?
1 reply
Hi
$this->reader->getSheetIterator()->current() returns null
richdear
@richdear
$this->reader = ReaderEntityFactory::createXLSXReader();
anyone can answer?
richdear
@richdear
??
richdear
@richdear
?
richdear
@richdear
?
how to resume where read of from sheet
stevex64
@stevex64_twitter
Any thoughts on this one - I have spout exporting an xlsx file from a symfony/php app. Excel can't open it, failing with error messages. But the file opens fine in LibreOffice Calc.
Daniel Fernández
@daniel89fg
hi
I have an error when trying to convert an xls to csv.
This is the error: Object of class DateTime could not be converted to string
This is my code...

$reader = ReaderEntityFactory::createXLSXReader();
$writer = WriterEntityFactory::createCSVWriter();
$writer->openToFile($pathCSV);
$reader->open($filePath);

foreach ($reader->getSheetIterator() as $sheet) {
foreach ($sheet->getRowIterator() as $row) {
$writer->addRow($row);
}
break;
}

The problem is in the dates with the format "05/22/2022", when using the / it gives an error.
I have tried to use: $reader->setShouldFormatDates(false); but it still doesn't work
Any help please?
Abdallah Saeed
@Abdallah7saeed_twitter
how i can adjust cell width and make sheet direction from left to right ?