Skip to main content

Notifications

Community site session details

Community site session details

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

Exporting Vendor Master data using x ++ code

(0) ShareShare
ReportReport
Posted on by 3,110

Hi Experts,

There is any ready x++ code which can export all vendor data to excel sheet . 

Best Regards,

Shabir Ahmad

  • Blue Wang Profile Picture
    on at
    RE: Exporting Vendor Master data using x ++ code

    Hi Shabir,

    You can use the SysExcel* class to export, try some published blog codes.

    Please refer this: imdaxershiv.blogspot.com/.../x-code-to-export-data-to-excel-sheet-in.html

  • Suggested answer
    mhdshb1 Profile Picture
    1,250 on at
    RE: Exporting Vendor Master data using x ++ code

    Hi Shabir, 

    Try this job it exports from VendTable.

    static void ExporttoExcel(Args _args)
    {
        SysExcelApplication              sysExcelApplication;
        SysExcelWorkbooks              excelWorkbookCollection;
        SysExcelWorkbook               excelWorkbook;
        SysExcelWorksheets             excelWorksheetCollection;
        SysExcelWorksheet              excelWorksheet;
        int                                          i =1;
        str                                          filename;
        vendTable                             vendTable;
        ;
    
    
        // give the file name and save it to c drive
         filename = "c:\\test.xls";
    
        // initlize the SysExcelApplication instance
        sysExcelApplication  = SysExcelApplication::construct();
    
        //create excel workbook and excel worksheet
        excelWorkbookCollection  = sysExcelApplication.workbooks();
        excelWorkbook    = excelWorkbookCollection.add();
        excelWorksheetCollection = excelWorkbook.worksheets();
        excelWorksheet = excelWorksheetCollection.itemFromNum(1);
    
        // excel column captions
    
        excelWorksheet.cells().item(i,1).value("AccountNumber");
        excelWorksheet.cells().item(i,2).value("AccountName");
        excelWorksheet.cells().item(i,3).value("VendorGroup");
        i  ;
        // fill the excel with vendtable Fields
        while select VendTable
        {
           excelWorksheet.cells().item(i,1).value(vendTable.AccountNum);
            excelWorksheet.cells().item(i,2).value(vendTable.name());
            excelWorksheet.cells().item(i,3).value(vendTable.VendGroup);
            i  ;
        }
    
        //check the fileName is already exist
         if(WinAPI::fileExists(filename))
             WinAPI::deleteFile(filename);
         // save excel file
         excelWorkbook.saveAs(filename);
    
        // open excel file
        sysExcelApplication.visible(true);
    
        // close excel file
     // sysExcelApplication.quit();
    
    }

    Hope this helps,

    Regards,

    M

  • Shabir Ahmad Profile Picture
    3,110 on at
    RE: Exporting Vendor Master data using x ++ code

    Hi Mohammad Al-Saheb,

    I wanted to use x++ job to export the vendor master data. I know DIXF is also good.

    Best Regards,

    Shabir Ahmad

  • Suggested answer
    mhdshb1 Profile Picture
    1,250 on at
    RE: Exporting Vendor Master data using x ++ code

    Hi Shabir,

    Do you really need to use x++ code to export ?

    You can use Data Import/Export Framework (DIXF) where you can export vendor data in a tabular format.

    Regards,

    M

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!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,110 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans