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

can't able to read site and warehouse values from excel

(0) ShareShare
ReportReport
Posted on by 454

Hi,

I need to read the Site and Warehouse values from an excel sheet. But it returns an empty value. For example if my site is "1" it returns empty. Here is the code. Help me on this.

site = cells.item(row, 4).value().bStr();
warehouse = cells.item(row, 5).value().bStr();

Regards,

Ram

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ram,

    Please check if the cells are storing the values as integers instead of string. That might be causing the values to be returned as empty.

  • Ram Kumar Profile Picture
    454 on at

    Hi Gunjan,

    As it is a integer value "1" it cant read ,it only reads a string value. what steps i have to do to read a number value.

    Regards,

    Ram

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    In AX, site and warehouse ids are strings. Therefore I suggest to handle them as strings in Excel, too. Otherwise you can't use the Excel or your code if your customer has (now or in the future) a site or warehouse where the id has other characters than numbers.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ram,

    You can try one of two options -

    1. Change the value in excel cells to be of type string, rather than integer. This is a better option you can set the excel template in the same way.

    2. You can try to convert the integer value to string and check if that works-

    site        = int2Str(cells.item(row, 4).value().int());
    warehouse   = int2Str(cells.item(row, 5).value().int());

  • Ram Kumar Profile Picture
    454 on at

    Hi Gunjan,

    I have already tried converting integer value to string but this also returns empty value.

    Regards,

    Ram

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ram,

    It's better you change the format of the cell to Text. If any string values are passed later like "1A", "2B" etc, your code will fail.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Ram Kumar,

    Check if you see "ComExcelDocument_RU" class in AOT. It has a method "variant2Str" which automatically converts a value from Excel type to string.

    site = ComExcelDocument_RU::variant2Str(cells.item(row, 4).value());
    warehouse = ComExcelDocument_RU::variant2Str(cells.item(row, 5).value());

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans