Ok I believe I understand now what you want. I don't have experience with csv files but I guess something like that should work:
$file = fopen('file.csv', 'r');
$id_product_column = x; // Define which column is id_product (first, second, or whatever)
while (($line = fgetcsv($file)) !== FALSE) {
$id_product = $line[($id_product_column-1)];
if ($id_product > 0) {
$product = new Product($id_product)
$product->save();
}
}
fclose($file);