You should be able to clean it up during import with a SSIS package if you know how or else you can do a batch load into a temp table and then clean it up when inserting into maintb.
Since you have a reference table you can use s select statement to insert the correct values but this would be a two step process. First load file then run the insert script.
I would invest some time in learning how to create SSIS packages if you are going to be doing alot of data importing or manipulation.
This insert statement should work if you just want to load and then run the script afterwards.
Insert into maintb (id ,name, type)
Select a.id, a.name, b.id
From temp a
Inner join referencetb b on a.type = b.type
You can also use a case statement in the insert but you have would to manually enter every type and change the script if the types ever change.