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

Cant able to read the Data from Excel Sheet

(0) ShareShare
ReportReport
Posted on by 454

Hi,

I have to read the Data from Excel sheet. Here below is my Excel sheet.The First item id i cant able to read the Second row i able to read. Any Suggestions please. I have tried formatting Cells but it hasn't help for me.

pastedimage1582867997747v1.png

Regards,

Ram.

I have the same question (0)
  • Suggested answer
    Ziyao Profile Picture
    on at

    Hi Ram, normally the first and send row in excel stores header and template information, try to start your first item on Row 3.

    For build in import by excel function, you need to copy paste your data to the excel template exported and then import by system, if this import by excel function is customized, please check your code.

  • Ram Kumar Profile Picture
    454 on at

    Hi Ziyao,

    My code can't able to read the only integer values(Eg:1000), but it can able to read the Values which is Suffixed with String (Eg: "D001"). that's what the issue i am facing now. can you able to understand my issue.

    Regards,

    Ram.

  • Ziyao Profile Picture
    on at

    Is this a customized import function or it's a standard build in import function? If it is a build in standard function, could you please indicate where it exactly placed?

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Can you share with us any details about how you are reading data from Excel sheet? Seems you forgot to mention it.

    Are you using one of the out of the box functionalities (defintion groups, DIXF) or did you write some own code?

  • Ram Kumar Profile Picture
    454 on at

    Hi Ziyao,

    Here is my code to read the Item id from Excel sheet.

    static void ReadingExcel(Args _args)
    {
    SalesTable                             salesTable;
    SalesLine                              salesLine;
    NumberSeq                              numberSeq;
    SalesFormLetter                        salesFormLetter;
    SalesFormLetter_PickingList            salesFormLetterpick;
    SalesId                                salesId;
    InventDim                              inventdim;
    Dialog                                  dialog;
    DialogField                             file;
    SysExcelApplication                     application,application1;
    SysExcelWorkbooks                       workbooks,workbooks1;
    SysExcelWorkbook                        workbook,workbook1;
    SysExcelWorksheets                      worksheets,worksheets1;
    SysExcelWorksheet                       worksheet,worksheet1;
    SysExcelCells                           cells,cells1;
    SysExcelCell                            cell1;
    SysExcelFont                            font;
    COMVariantType                          type,type1;
    FileName                                filename,filename1;
    str Custaccount,itemno,salesunit;
    real quantity;
    real salesprice;
    
    int row=1;
    int row1 = 2;
    dialog = new Dialog("Please select the file to load");
        dialog.addText("Select file:");
        file   = dialog.addField(ExtendedTypeStr("FilenameOpen"));
        dialog.run();
    
        if (dialog.closedOK())
        {
            info(file.value());
    
            application = SysExcelApplication::construct();
            workbooks = application.workbooks();
            //specify the file path that you want to read
            filename =file.value(); //ExcelSheet File Name
            try
            {
                workbooks.open(filename);
            }
    
            catch (Exception::Error)
            {
    
                throw error('File cannot be opened');
    
            }
    
            workbook = workbooks.item(1);
            worksheets = workbook.worksheets();
            worksheet = worksheets.itemFromNum(1); //Here 1 is the worksheet Number
            cells = worksheet.cells();
            do
            {
            row  ;
            itemno = any2str(cells.item(row,2).value().bStr());
            info(itemno);
            type = cells.item(row 1, 1).value().variantType();
            }
            while (type != COMVariantType::VT_EMPTY);
    
            workbooks.close();
            application.quit();
    
            info("Done!");
    
        }
    }

    Regards,

    Ram.

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    And do you get some error when you run it? What error? What line of code causes the error?

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 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans