-1
導入Excel工作表到Mongodb數據庫與列Mapping.I需要一個類似於pipedrive導入數據的PHP插件,請建議是否有任何。導入Excel工作表到Mongodb數據庫與列映射
導入Excel工作表到Mongodb數據庫與列Mapping.I需要一個類似於pipedrive導入數據的PHP插件,請建議是否有任何。導入Excel工作表到Mongodb數據庫與列映射
您可以自己創建它。我已經開發了這種代碼是從MySQL數據庫中讀取數據,並把它在MongoDB中,它的代碼是:
$collection = $db->createCollection("emp_details");
$collection->createIndex(array('email' => 1));
$getAllEmp = "select first_name, last_name, position, email, office, start_date, age, salary from datatables_demo";
$resAllEmp = mysqli_query($conn, $getAllEmp);
$data = array();
$count = 1;
if(mysqli_num_rows($resAllEmp) > 0)
{
while($row = mysqli_fetch_assoc($resAllEmp))
{
$data['_id'] = new MongoId();
$data['emp_id'] = $count;
$data['first_name'] = $row['first_name'];
$data['last_name'] = $row['last_name'];
$data['position'] = $row['position'];
$data['email'] = $row['email'];
$data['office'] = $row['office'];
$data['start_date'] = $row['start_date'];
$data['age'] = $row['age'];
$data['salary'] = $row['salary'];
$data['project'] = array('Project1', 'Project2', 'Project3');
$data['password'] = md5('12345');
if($collection->insert($data))
{
$count++;
}
}
}
使用上面的代碼,並通過刪除Mysql的部分修改和補充CSV閱讀部分,它和它工作正常。