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 .

  • Martin Dráb Profile Picture
    231,821 Most Valuable Professional on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    You already have the code.

    But you shouldn't use it, because no code is needed. What you want to achieve is already supported by DIXF and there is no point reinventing the wheel and wasting resources to develop it again.

  • Axbeginerss Profile Picture
    25 on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

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

  • Martin Dráb Profile Picture
    231,821 Most Valuable Professional on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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.

  • Suggested answer
    Martin Dráb Profile Picture
    231,821 Most Valuable Professional on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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.

  • nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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.

  • Axbeginerss Profile Picture
    25 on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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,156 Moderator on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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.

  • Mav Profile Picture
    on at
    RE: How to import Multiple Excel from a specific folder in ax 2012

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,978 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,821 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans