{"id":20753,"date":"2016-04-08T08:24:52","date_gmt":"2016-04-08T14:24:52","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/axsupport\/?p=20753"},"modified":"2023-07-05T12:18:07","modified_gmt":"2023-07-05T19:18:07","slug":"dixf-importing-data-using-excel-and-odbc","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/dynamics-365\/blog\/business-leader\/2016\/04\/08\/dixf-importing-data-using-excel-and-odbc\/","title":{"rendered":"DIXF – Importing data using Excel and ODBC"},"content":{"rendered":"
Consider a scenario where you are running AX 2012 R3<\/strong> and you want to import data from Excel files using ODBC. <\/strong>Having recently worked a case on this topic, I thought I\u2019d share some of the details on how this can be set up.<\/p>\n 1. Background<\/strong><\/span><\/p>\n The main reason we were looking into this way of importing Excel data was that trying to import the data in Batch<\/strong> using Excel files<\/strong> would in some scenarios result in this error:<\/p>\n The version of Microsoft Excel is not supported.-Exception from HRESULT: 0xC020801C<\/strong><\/span><\/p>\n Working with a LCS Repro VM<\/strong> we were able to reproduce the issue, and then establish an alternative approach <\/strong><\/span>that I will outline below.<\/p>\n There are lots of ways to import data into Microsoft Dynamics AX<\/strong> and this is only one of them. The best tool for the job and approach will depend on many factors<\/strong>, including the degree of control you have over source data formats (CSV File, Excel File, XML File, AX, ODBC<\/strong>), the frequency of the imports, the complexity of the entities being used, security considerations, etc.<\/p>\n The aim of this blog post is simply to outline one<\/strong> approach which you may be considering.<\/p>\n 2. Prepare the environment<\/strong><\/span><\/p>\n In this example, we are working with a very simple 2 column Terms of delivery<\/strong> entity Excel<\/strong> input file.<\/p>\n A.<\/strong><\/span> Download the 64-bit version of Microsoft Access Database Engine 2010 Redistributable<\/strong>:<\/p>\n http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=13255<\/a><\/p>\n B.<\/strong><\/span> Copy the installer <\/strong>to a local folder <\/strong>and run the install from command line<\/strong> using the \/passive<\/strong> parameter:<\/p>\n C:\\MSFT\\AccessDatabaseEngine_x64.exe \/passive<\/strong><\/p>\n C.<\/strong><\/span> Backup the registry<\/strong> and rename the key mso.dll<\/strong> in the following location:<\/p>\n Warning:<\/strong> <\/span>Incorrectly editing the registry may severely damage your system. At the very least, you should back up any valued data on the computer before making changes to the registry.<\/p>\n HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\14.0\\Common\\FilesPaths<\/strong><\/p>\n D.<\/strong><\/span> In Windows<\/strong>, create a 64-bit ODBC data source<\/strong> pointing to the Excel file<\/strong> to be imported:<\/p>\n E.<\/strong><\/span> In AX<\/strong>, create an ODBC source data format<\/strong> using the 64-bit ODBC data source<\/strong> created before:<\/p>\n F.<\/strong><\/span> In AX<\/strong>, create a Processing group<\/strong> using the source data format just created. The query should look like: select * from [worksheet$], for example:<\/p>\n Select * from [S1$]<\/strong><\/p>\n G.<\/strong><\/span> In AX<\/strong>, generate the mapping and test:<\/strong><\/p>\n 3. Run the DIXF Excel file \/ ODBC source data format import as a Batch The Batch job is executing<\/strong>:<\/p>\n The Batch job has ended successfully<\/span><\/strong>:<\/p>\n<\/a><\/p>\n
\/\/ Disclaimer:<\/span>\n\/\/ Microsoft provides programming examples for illustration only, without warranty<\/span>\n\/\/ either expressed or implied, including, but not limited to,<\/span>\n\/\/ the implied warranties of merchantability or fitness for a particular purpose.<\/span>\n\/\/ This mail message assumes that you are familiar with the programming language that<\/span>\n\/\/ is being demonstrated and the tools that are used to create and debug procedures.<\/span>\n\/\/<\/span>\n\/\/ This source code is freeware and is provided on an \"as is\" basis without warranties of any kind,<\/span>\n\/\/ whether express or implied, including without limitation warranties that the code is \n\/\/ free of defect, <\/span>fit for a particular purpose or non-infringing. The entire risk as to the \n\/\/ quality and performance of <\/span>the code is with the end user.<\/span>\n<\/pre>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/a><\/p>\n
<\/strong><\/a><\/p>\n
\n<\/strong><\/span>
\nWe can now proceed and run<\/span> the DIXF import<\/strong> using Batch processing<\/strong>:<\/p>\n<\/strong><\/a><\/p>\n
<\/strong><\/a><\/p>\n