3

I have read the data from the CSV

$data = $fileCsv->getData($file);
foreach ($data as $row => $data) {
    if ($row > 0) {
        print_r($data);
    }
}

I have got the content only the one column that is Customer Email.

1 Answer 1

5

Please try following way so you get email column data

 <?php
$file = fopen('example.csv', 'r');
$c = 0;
while (($line = fgetcsv($file)) !== FALSE) {
//$line is an array of the csv elements
    $c++;
    if($c == 1){
        continue;
    }
    echo $line[3]; // Here 3 is my column that contain email
}
?>
2
  • Hey For this I am getting the column name. How to get Data from the column name
    – Divya
    Commented Dec 19, 2019 at 6:08
  • 1
    @Divya please check my update answer.Now we skip column name. Commented Dec 19, 2019 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.