I followed the solution introduced here https://stackoverflow.com/a/36041188/11295637 to create a new csv file and fetch specific columns of a large csv file to the new one. But, I get this error: Uncaught Error: Call to a member function insertOne() on null.
The code is as follows:
php
$new= Writer::createFromPath('path\to\file', 'w+');
$filename= Reader::createFromPath($filename, 'r');
$filename->setOffset(1);
$filename->each(function ($row) use ($indexes) {
$new->insertOne($row);
return true;
});
The problem is that the new variable is undefined. I tried also
php
$new= Writer::createFromFileObject(new SplTempFileObject());
But I got the same error.