Note that there are some explanatory texts on larger screens.

plurals
  1. POEditing Data in an XLS with PHP then importing into mySQL
    text
    copied!<p>I am trying to import an XLS file into PHP, where I can then edit the information and import it into mySQL. I have never done anything related to this, so I am having a hard time grasping how to approach it.</p> <p>I have looked at a few open source projects:</p> <ul> <li>PHP Excel Reader</li> <li>ExcelRead</li> <li>PHPExcel</li> </ul> <p>None of these options perfectly fit what I want to do or maybe I just haven't gone deep enough into the documentation.</p> <p>There are some things that needed to be taken into consideration. The XLS file cannot be converted into any other file format. This is being made for ease-of-access for nontechnical users. The XLS file is a report generated on another website that will have the same format (columns) every time. For example, every XLS file with have the same amount of columns (this would be A1):</p> <pre><code>*ID |Email |First Name |Last Name |Paid |Active |State |Country|* </code></pre> <p>But, there are more columns in the XLS file than what is going to be imported into the DB. For example, the rows that are being imported (this would be A1):</p> <pre><code>*ID |Email |First Name |Last Name |Country* </code></pre> <p>I know one of two ways to do edit the data would be A. Use something like PHPExcel to read in the data, edit it, then send it to the DB or B. Use something like PHPExcel to convert the XLS to CSV, do a raw import into a temp table, edit the data, and insert it into the old table.</p> <p>I have read a lot of the PHPExcel documentation but, it doesn't have anything on importing into a database and I don't really even know where to start with editing the XLS before or after importing.</p> <p>I have googled a lot of keywords and mostly found results on how to read/write/preview XLS. I am looking for advice on the best way of doing all of these things in the least and simplest steps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload