Excel / Leading 0 / xlsb

Hello everyone,

I’m looking for a solution regarding the write range activity.

I have to write some datas in an .xlsb file.
So the worbook does not work, I have to go with Excel scope.

The problem is that with Excel scope, when my data starts with “0”, it skip it when writing it.

I know with the workbook activity the “0” is kept but as it is an xlsb file, this solution is not working.

So to summarize I neet to write datas while keeping the leading “0” !

If you have any solution to share please let me know :slight_smile:
Have a nice day,

If it’s just for visual purposes, you could try adding a single apostrophe to the start of the values before writing them to the Excel workbook.

For example, make your value '000563 instead of 000563.

This will cause Excel to treat your value as text, which will display your leading zeros. However, that also means it stops treating the value as a number, which could have other implications, so just something to be mindful of.

Thanks for answering Matthew,

It’s working fine for me (from what you’ve said I change the whole column as text type).

But if a number was needed, do you have any other idea to deal with it ?

That’s great.

To keep it as numbers, you would probably need to set a custom number format in excel and not use the apostrophe.

Thanks a lot ! Have a nice day :slight_smile:

if you’re needing to use it as an integer you can store it in an integer value using var = cint(stringvalue)

or as a double with var = cdbl(stringvalue)

Thanks for the tip Aquinn, I’ll remember that :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.