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

Format a column in Excel worksheet to Text

(0) ShareShare
ReportReport
Posted on by 15

Hi,
How can I format my Excel workbook to have the column as Text?

If I pass this field (defined as a string):

xlsWorkSheet.cells().item(1,4).value(custTable.VATNum);

It will be regarded as an integer.

I have in my field in column D a string (say "0001").

When Excel creates the column it interprets the string as number and removes the leading "000" and will convert it to integer.

I don't want that and the text should remain.

Can I use this below in some way?

xlsWorkSheet.cells().range('D:D').?

Any idéas?

Regards,

/Fredrik. 

  • Fredrik Brandt Profile Picture
    15 on at
    RE: Format a column in Excel worksheet to Text

    Hi again,

    I found it.

       //Format column D to Text in the worksheet - @ means data stored in excel as string

       xlsWorkSheet.cells().range('D:D').numberFormat('@');

    Thanks.

  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: Format a column in Excel worksheet to Text

    Hi Fredrik Brandt,

    Check whether the below Microsoft documentation will help your scenario.

    https://learn.microsoft.com/en-us/office/vba/api/excel.range.numberformat

    Thanks,

    Girish S.

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,145 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,896 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans