As the first create the importproducts.php file inside the script folder in the magento root directory.Then establish the database connection as shown below.
<?php
define('DS', DIRECTORY_SEPARATOR);
use \Magento\Framework\App\Bootstrap;
include('../app/bootstrap.php');
$bootstrap =...