Business Central: How to insert Sales Lines through excel

Recently in a Telegram group about Business Central, a user with the intention of migrating his ERP to Business Central, commented that with his previous ERP, he could import Purchase Lines using a CSV file, the point is that our beloved ERP does not do it directly in the documents lines but through configuration packages.

The good thing is that Business Central allows you to carry out almost all kinds of customizations.

Today, I’m going to do a micro post on how to achieve this requirement directly in Sales Lines using Excel Buffer.

Video Demo

The following video shows how simple customization allows us to import Sales Lines to Business Central

Code

Codeunit ImportExcel

We will use this codeunit to:

  • Upload the Excel file to Business Central
  • Load the Excel Buffer with the Excel file
  • Read each cell of the Excel file and create our Sales Lines

Page Sales Order Subform

In this Page extension, we will call our previous codeunit to read and import the Excel file.

Conclusion

Business Central provides many tools to achieve almost anything within the ERP, in this scenario I used Excel Buffer, but XmlPort could be used. Also, target the code to Sales Lines, but the Purchase Line could also have been used with a slight change.

I hope this is useful for those who need to perform this type of import.

All the code is in this Github repository.

Leave a Reply

Your email address will not be published. Required fields are marked *