I assume you have a resource model for your custom entity (otherwise it won't work).
The resource model should be placed in [Namespace]/[Module]/Model/Resource/[Entity].php
.
Create this method inside that resource model
public function saveImportData(array $data){
if (!empty($data)) {
$columns = array('region_name', 'cost'); //add here all your column names except the autoincrement column.
$this->_getWriteAdapter()->insertOnDuplicate($this->getMainTable(), $data, $columns);
}
return $this;
}
Now in the action where you upload your file, parse that file and create an array with the rows to be inserted.
Your array should look like this:
$toImport = array(
array('region_name' => 'Region 1', 'cost'=>'12.99', ...rest of the fields here),
array('region_name' => 'Region 2', 'cost'=>'17.99', ...rest of the fields here),
....
)
Now you just need to call in the controller
Mage::getResourceModel('[module]/[entity]')->saveImportData($toImport);