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
Cally
@Gricey404

hi all

Import CSV
Read CSV
Sort CSV check data is okay and consistant
Filter CSV via rules
Display Current Imports inc how many skipped / imported / updated
Confirm Import
save to database

is Box/spout able to do this
1 reply
Aster
@asterd
Hi all, i need to open an existent excel file (something like a base model), modify it in memory and download to client
do you think is possibile whitout writing on disk with spout?
something like open, read and instead of persist, return something like a MemoryFileResponse?
Adrien Loison
@adrilo
@asterd It's possible to read your base template, write a modified version of it without needing to store the final version on disk. Note that XLSX file processing always require some writes on disk (but they can be temporary) as we need to assemble/zip a bunch of XML files together.
You can look at the 2 first guides for help: https://opensource.box.com/spout/guides/
Aster
@asterd
ok thanks a lot..
bluemoonfr1
@bluemoonfr1
@adrilo Dans le cadre d'un projet qui consiste à extraire des données d'une base et de générer des fichiers excel et Ods, j'ai été amené à apporter quelques modifications à Spout pour avoir le même niveau de production dans les deux formats (ajout de l'alignement vertical, des liens htttp, des formats de nombre et de date pour ODS, possibilité de mettre une partie du texte d'une cellule dans une couleur différente - ou de lire une cellule ainsi formatée), j'aimerais vous envoyer un exemple de cette production. Où puis-je le déposer ?
3 replies
Ian Wellock
@NightIsland
Is it possible to find out how many rows are in an XLSX file after opening it?
Adrien Loison
@adrilo
@NightIsland You have to iterate through all the rows. Some XLSX files do have the information ready before reading them entirely but some don't. That's why in Spout we took the decision to force users to read the entire spreadsheet.
This would work:
foreach ($reader->getSheetIterator() as $sheet) {
    $numRows = 0;
    foreach ($sheet->getRowIterator() as $row) {
        $numRows++;
    }
}
Although it may take a while for large spreadsheets
brightinnovator
@brightinnovator

I want to read 3 crore csv rows which is of 2GB csv file size and need to insert into MySQL via Java.

Could someone please help me know the fastest and memory efficient way to avoid out of memory exception as well load in lesser time?

Please kindly advise.

markosko
@markosko
@brightinnovator try use transactions, and insert in batches
brightinnovator
@brightinnovator
@markosko can you please help me with a good reference link...any good link you suggest to be followed..that would help a lot..i don't even require a full code but looking for some suggestions, links and comments
markosko
@markosko
hard to do but why u combine php and java ?
brightinnovator
@brightinnovator
i don't got help in anywhere..so pasted here. Please share a link if possible
Madhur Bhaiya
@madhurbhaiya

Hi, I have received a XLSX file from client (which I believe is created using Excel 2007). But Spout is giving "Error on opening file" for this excel.
I have created issue here: box/spout#823

Can someone take a look pls

Ruben Pajaron
@narachamus_gitlab
Hello guy ,I have a little problem with Spout, everything works fine, it creates and downloads a generated xlsx with my rows, but
it downloads the file with the name of the php containing the code, not with the one I assign to it (example: "test.xlsx")
If the code is in the file "export.php", the name of the xlsx file downloaded is "export.php", if I rename it to "export.xlsx", it is ok.
Could someone please help me?
Ruben Pajaron
@narachamus_gitlab
ammmm, solved xd
isidoroi
@isidoroi
excuse me, but example for convert xls to csv with spout? read xls ok...but write to csv reading xls? thank you
p1xel007
@p1xel007
Can I use it with Laravel queue?
2 replies
markosko
@markosko
Yes its possible but u need to get to read row by row and count yourself as there is no way to get that info from simply looking at file but to read whole file
@p1xel007
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