web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to import Multiple Excel from a specific folder in ax 2012

(0) ShareShare
ReportReport
Posted on by 25

i have to import a data from multiple excel from a shared folder in ax 2012 using runbasebatch .

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    I recommend using DIXF (Data Import Export Framework), it supports importing multiple files from a folder and you don't need to write any code.

  • Mav Profile Picture
    on at

    DIXIF wont work if you are trying to upload multiple sheets of an excelworkbook into same custom entity.

    Something similar is already being discussed here at this thread .

    Thanks

    Mav

  • Axbeginerss Profile Picture
    25 on at

    Thanks for reply Nikolaos Mäenpää

    but the requirment is to read multiple excels from a shared folder and update in Ax Tables using Runbase batch.

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Ok, so I assume you got some business requirement from your customer, and then decided that RunBaseBatch is the best/only way to solve this requirement. Correct?

    Just to make sure we can assist you in best possible way, could you share the business requirement?

    Often development a customization should be considered only if non-development options were not feasible in fulfilling the business requirement.

  • Axbeginerss Profile Picture
    25 on at

    Client will get the data from a thirdparty and they will save those files in a shared folder .they will give us the path to access the folder.they ask us to create a batch job to read multiple excel s and once the excel is read it should move to another folder.

  • nmaenpaa Profile Picture
    101,162 Moderator on at

    Ok, sounds that you could do that with DIXF.

    Not sure if moving the file to another location is possible. But for that you could have some simple script that copies files from the source folder to DIXF folder AND "processed" folder.

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    It's supported out of the box - you can set "Completed directory" in DIXF setup. See Recurring batch job import in AX 2012 R3 for details.

  • Axbeginerss Profile Picture
    25 on at

    container createListOfFiles()

    {

       System.Array    files;

       int             fileCount;

       int             i;

       str             nextFile;

       container         listOfFiles;  

       new InteropPermission(InteropKind::ClrInterop).assert();

       info(strfmt('Search in: %1 %2',  @"C:\ReadFromExcel", '*.xlxs'));

       listOfFiles     = connull();

       //actIx           = 0;

       files           = System.IO.Directory::GetFiles( @"C:\ReadFromExcel", '*.xlxs');

       if (files)

       {

           fileCount =    files.get_Length();

           info(strFmt('Number of files in directory: %1', fileCount));

           for(i=0; i < fileCount; i++)

           {

               nextFile    = files.GetValue(i);

               listOfFiles += nextFile;

           }

       }

       CodeAccessPermission::revertAssert();

       info(strFmt('Files count: %1', conlen(listOfFiles)));

       return listOfFiles;

    }

    here--- fileCount =    files.get_Length(); is giving me zero even though there are 6 xlxs files in the folder.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Remember that the best code is the one that you don't have to write, test, debug, document, maintain...

    First of all, check if your code runs on the same machine where you have the files. You may have files in client and running code on AOS.

  • Axbeginerss Profile Picture
    25 on at

    can i get code to loop a folder and get the name of excel file  ??

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans