How to export to an Excel file with custom layout
When to use the Pimics Excel export
Business Central contains an Excel integration by default, and this integration can be used for internal ERP purposes. However, if you want to export a price list or another type of feed with a custom layout, the default integration cannot be used. That is the reason why we made Pimics functionality that will allow you a lot of flexibility in defining the data for your Excel exports, and deciding how you want them to look.
Before exporting to Excel
There are several things to be set before being able to export data to an Excel file.
We recommend downloading our RapidStart package PackagePIMICS.ENU.EXCELEXP.rapidstart from our configuration packages page. It contains the base configuration which you can then change for your own purposes. For more details see our packages documentation.
Mapping
A mapping is typically created once per export type. You can use this mapping to define the format and layout of your Excel data. You can look at it as defining the header for your Excel exported file. The actual data will be added to this header at the time the data will be exported. Which items, categories or prices will be included into the final exported file is defined in the particular publication that you will export from.
If you use our predefined configuration package, some values can be already created. Be sure to change them if you need to.
- Using Alt+Q, search for export mapping and then click on the relevant link
- Select New to create a new mapping
- Specify the Description
- Set Excel in field Type; after that a new group Excel - Details will become available
- If you already have a file which should be used as a template select it in the field Template File
- In case no template is uploaded, data will be exported into an empty Excel worksheet
- Go to Excel - Details and create a new line, specifying these fields:
- Target List Name to set a name for the Excel list
- First Data Line to set a line number beginning from where data will be inserted
- Select List Settings from the group actions
- In page Excel Export Mapping Line you can define a mapping between data in Pimics and the export
- Create a new line
- Set Source Type to Item
- Set Source Field No. to 1. Lookup and select field Code
- Set Destination Type to Column
- Set Destination Value to A
- Repeat steps 1 to 5 to create other fields, updating the column label. Or you can use action Copy to create a new line
- Close all pages
Publication Setup
- Using Alt+Q, search for publication channel and then click on the relevant link
- Select New to create a new channel
- Specify Code and Description
- Set Type to Excel
- Set Publication Type to No Details
- In Excel group select the Mapping Code that you created before in Mapping
- Using Alt+Q, search for publication group and then click on the relevant link
- Create a new publication group for all types that you want to include in your publication, with predefined filters and rules. How to create publication group.
- Close all pages
Exporting product data
We recommend creating a publication for each different purpose. For example if you need to export different items (or prices) for different customers, each should have their own publication set up, using the same mapping.
In this scenario we assume that you downloaded and applied the Allium-provided configuration packages. All values are included in this package, and they can be changed at any time to suit your own purposes.
- Go to Publication Management > Publications
- Create a new publication and select Excel (Publication) from the template list
- Select Edit to open the publication card
- Define settings for pricing in group Pricing & Period
- In field Export Channel specify the channel you created previously in Publication Setup
- Select Publication Structure
- Define data for the export
- Select the data you want to include in your export, by using the function Insert New Peer
- The data is inserted into the publication and you can browse it in the publication tree
- Here you can find more details about how to define a publication structure
- Close the page Edit Publication Tree
- Select Process and then Publish
- The Excel file is generated and downloaded
- When running the export at a later date, it is best to first run either Update Publication or Reorganize Publication, to update the publication data. More details here
- Close all pages