I am creating an excel report by changing the content type.
Response.ContentType = "application/vnd.ms-excel"
I have values that contain leading zeros. The issue is when exporting to excel the leading zeros are missing.
e.g.
000123 -> 123
I know that this can be changed manually via excel. The question is how can i accomplish this programmatically?
Ive found the answer, you can surround the value in quotes and prefix it with an equals sign to preserve the leading zeros.
="000123"
See here: Excel vs. Leading Zero & Space
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With