This topic is locked

How to change record entry row(s) function in Excel Import for PHPR

10/18/2015 7:13:40 AM
PHPRunner Tips and Tricks
A
Abul author

Sometime we want an Excel sheet with bulk records to be imported into db through PHPR UI list page. By default PHPR import function will take 1st row of the imported excel sheet as column header label and records from row#2 will be inserted.
However, sometime we need to put some important instructions for users on the top few rows on excel sheet about the data format or other things. In this case our main records probably started from row#11 on so on. Now if we try to import bulk records from an excel sheet started from any other row# other than row#2 then PHPR will not import records by default.
I have found the solution. You just need to edit two lines code manually in “include/import-function.php” page after building the application.
In this page you will find following codes:

  1. function around line#18.
    function getImportExcelFields($data)


2. You have to change default row#) on around line # 47. By default it is 2

$highestRow = $worksheet->getHighestRow();

for ([color="#FF0000"]$row = 11; $row <= $highestRow; ++ $row)


3. And also change similarly on around line # 100

$ret = InsertRecord($arr, , $error_message, $goodlines, $keys, $keys_present,

$strOriginalTableName, $pageObject, $cipherer, $autoinc);

$total_records++;


That’s it.