How to use script to import heightmap?

Hi,
I have my raw format file,this file can be well import in unity though terrain component by UnityEditor.How can I use script to import the heightmap file instead though the UnityEidtor?

I believe this is what you need:

AssetPostprocessor