Skip to main content

Notifications

Community site session details

Community site session details

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

Sample code for reading excel workbook from a path into ax table via batch jobs

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

Can anyone help  me with sample code which would read entire excel workbook (as it is all sheets in workbook i cannot use dixif) from a particular network drive path  on periodic basis & populate data into ax table.

I think SysExcel class wont work as that will work at client level only.

Thank

Mav

  • Suggested answer
    Martin Dráb Profile Picture
    232,068 Most Valuable Professional on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    Don't try to solve all problem at once. Let's focus on reading the file for now and if you don't know how to work with AX tables, let's address that later.

    Does it mean that you rejected both transforming the file and using ExcelPackage to import the file? Then you can surely find some other libraries, but you should explain why you rejected this one, so we can suggest something more suitable for you.

    Or does it mean that you don't know how to use ExcelPackage and you simply gave up? Do you have any particular problem? Did you look at examples on the internet?

  • Mav Profile Picture
    on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    This is in Ax2012 can you share some sample code or reference where I can address below scenario.

    read excel workbook (all sheets) periodically from a folder

    enter that data into ax table

  • Martin Dráb Profile Picture
    232,068 Most Valuable Professional on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    Then you would need multiple projects.

    I personally wouldn't do it, though. Having an extra step transforming the file to something that you can easily import sounds much easier to me.

  • Mav Profile Picture
    on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    So what is stopping me is the error that entity A is already used which i get when adding entity A again in 2nd line  for sheet 2.

    How can i overcome this in processing group form.

  • Martin Dráb Profile Picture
    232,068 Most Valuable Professional on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    If you know how to import a single worksheet (and how you select which one), what is preventing your from importing multiple worksheets one by one?

    Yes another approach would be transforming the file before importing.

  • Mav Profile Picture
    on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    My 1st preference is DIxif   & hence wanted to check if  you can pls elaborate on

    "I think you could also process the file with DIXF, just not at once, but a single worksheet at a time."

    Scenario

    1 excel workfbook - multiple sheets all of this data to go into 1 single custom entity in Ax2012 via batch job i.e. minimum user intervention.

  • Martin Dráb Profile Picture
    232,068 Most Valuable Professional on at
    RE: Sample code for reading excel workbook from a path into ax table via batch jobs

    You can use ExcelPackage class from OfficeOpenXml namespace. You can find plenty of examples on the internet; some of them are even for AX 2012.

    I think you could also process the file with DIXF, just not at once, but a single worksheet at a time.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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... 293,289 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,068 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans