You can use the below link to see the code that could help you in achieving this. vinayofvarghese.wixsite.com/.../import-sales-order-lines