1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Read an Excel file from PHP?

Discussion in 'PHP' started by mikelbeck, Aug 11, 2005.

  1. elrayyes

    elrayyes Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Thank you itsbobbs for the info. I did manage to setup phpExcelReader, and it worked perfectly. Nevertheless, the only issue that I have with this is that when it displays the table, it still uses the row and column headers (i.e. A, B, C, ... and 1, 2, 3, ....). Now I am not very familiar with PHP or coding in general, but my intended target is to treat my first row as the header for the table. Is there a way to do that? any suggestions?
     
    elrayyes, Jun 6, 2008 IP
  2. pushpendragold

    pushpendragold Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Thanks it is really helpful,before that I tried too many ways to do the same thing and found no way better than this. I want to commit that I am Lucky to find the best solution. :D
     
    pushpendragold, Jul 26, 2009 IP
  3. abdidalem

    abdidalem Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    i just download the code, i will share soon
     
    abdidalem, Jul 26, 2009 IP
  4. pushpendragold

    pushpendragold Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    The code provided here works fine, but I am having problem with getting number of rows present in excel sheet.
    When I am working with the given code the maximum number of rows shown was 83. But the excel file has more the 83 rows and other rows are not shown.
    Please help..
     
    pushpendragold, Jul 27, 2009 IP
  5. wianprag

    wianprag Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    I am not able to read a excel file with an extension .xlsx . I am using the same library file. Please help me . I am waiting for you reply.

    Thanks in advance
     
    Last edited: Aug 18, 2009
    wianprag, Aug 18, 2009 IP
  6. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #26
    premiumscripts, Aug 18, 2009 IP
  7. kalpan_vyas

    kalpan_vyas Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    Hi all

    The excel file reader is great and its working for me as I was expected.

    The only problem I am facing is that My excel file is in multiple languages. column D to R represent the text translation of text present in column c (in English). I want to read the correct text in to foreign language and insert it in to mysql DB.

    When I try to change the character set the excel reader is only able to read few column for others its printing empty.

    How can I fix this problem??

    any help is much appreciated.

    Thanks in advance
    KK
     
    kalpan_vyas, Sep 27, 2009 IP
  8. futonguy

    futonguy Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #28
    Hi all
    i had downloaded phpExcelReader and opened the file up. All seem to work fine except receiving this error:
    Deprecated: Assigning the return value of new by reference is deprecated in C:\Program Files\www\Excel\reader.php on line 124.
    I had no idea how to fix this problem. Also when i view the ExcelRead.php, only 5 rows were shown. How am i suppose to increase the number of rows if i needed? Please advise..

    thank you.
     
    futonguy, Oct 28, 2009 IP
  9. vivekgs2007

    vivekgs2007 Member

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #29
    HI to all,
    I used the files for importing the excel file...i need to know about how to store the excel records to mysql database from front end....please help me in that..
     
    vivekgs2007, Aug 23, 2010 IP
  10. kashifwebpro

    kashifwebpro Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #30

    I have the same problem, when i was working with excel, but thanks to php classes , i found a class (Native php class), by using that it solved my problem..you can try that it will help you out..

    visit here: http://www.phpclasses.org/package/6235-PHP-Parse-and-access-binary-Excel-files-in-pure-PHP.html
    Thanks
     
    kashifwebpro, Nov 23, 2010 IP
  11. Rubydk1210

    Rubydk1210 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #31
    I have the same problem but i deleted character "&" on line 124. Then, all seem to work fine.
     
    Rubydk1210, May 30, 2012 IP
  12. michaelhomas83

    michaelhomas83 Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #32
    <?
    include 'Excel/reader.php';
    $excel = new Spreadsheet_Excel_Reader();
    $excel->read('clientlistnew.xls');
    $x=2;
    ?>
    <table width="90%" border="0" align="center" cellpadding="0" cellspacing="5">
    <?
    $k=1;

    while($x<=$excel->sheets[0]['numRows']) {
    $y=1;

    $cell = isset($excel->sheets[0]['cells'][$x][$y+0]) ? $excel->sheets[0]['cells'][$x][$y+0] : '';
    $cel2 = isset($excel->sheets[0]['cells'][$x][$y+5]) ? $excel->sheets[0]['cells'][$x][$y+5] : '';





    $sql1 ="update globe_clientmaster set ref_area ='".$cel2."' where clientid = '".$cell."'" ;
    echo $sql1."<br>";
    // echo $sql1."<br>";
    //$res =mysql_query($sql1) or die("Error in Table".mysql_error());
    //$cid = mysql_insert_id();




    ?>

    YOu will get reader.php file from google its common class
     
    michaelhomas83, Jun 1, 2012 IP
  13. savani24

    savani24 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #33
    it read only word "xls" 97-2003 format do something for word 2007 or xlsx format
     
    savani24, Aug 3, 2012 IP
  14. karpovigorok

    karpovigorok Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #34
    All solutions is good only for small files.
    If you want to read more than 10 000 rows without "out of memory" you can try to use XLS API parser
    See documentation. http://noxls.net/documentation its easy.
     
    karpovigorok, Jul 5, 2014 IP
  15. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #35
    He specifically asked IN php... You gave him an answer which requires learning a completely new language.
     
    NetStar, Jul 6, 2014 IP
  16. chamika weerasinghe

    chamika weerasinghe Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #36
    you can use https://phpexcel.codeplex.com/ is this too hard
    you can convert as 'csv' and read it
    that it easy
     
    Last edited: Jul 7, 2014
    chamika weerasinghe, Jul 6, 2014 IP