Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Retain Leading Zero in CSV


We are exporting the output in CSV format but CSV is not showing leading zeros.

For example - if the value is 0002 then it appears as 2 in CSV.

Is there any method or trick to retain leading zeros.

Although, this can be done through excel macro(after the file is opened) but for that manual intervention is required.

Is there any way to run excel macro through web page ? I mean if we could automate the procedure of running macro.

so that user just clicks on the button "Export to CSV" on web page and he gets the output in Excel with leading zeros retained.



Former Member
Former Member replied

Hi Anil,

If you want to retain the leading zeros you can use an equal sign in front of your double quoted values.

like that:


That should do the trick.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question