0

I'm writing a xls file into an application server folder (al11).

I need to keep leading zeros for some fieds, so i tried to concatenate ' character before value. Data is written in server file using OPEN DATASET, TRANSFER, ecc...

When I download the file into local folder, the cell in excel is not formatted as a text cell, but ' is shown in the cell. So my codes are not what I expected because of ' character.

How to fix this problem?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Darko
  • 1,448
  • 4
  • 27
  • 44
  • 2
    I assume you write CSV files and change the file extension to xls. That ' trick doesn't work on CSV files, excel interprets that sign as part of your string, as you already discovered. Quotes alone also don't work. But if you use the equal sign and quotes, excel should treat your numbers as text: http://stackoverflow.com/questions/165042/stop-excel-from-automatically-converting-certain-text-values-to-dates – Dirk Trilsbeek Feb 01 '16 at 10:12
  • Adding equal doesn't solve my problem. In the cell, instead of `01`, now i see `=01` – Darko Feb 01 '16 at 10:25
  • 2
    both equal sign and quotes around your text, like this: ="0123". At least with file extension csv excel 2013 recognizes the field content as a string. – Dirk Trilsbeek Feb 01 '16 at 10:26
  • 1
    If your data field will ever have commas in it, you may want to do it how this answer details: http://stackoverflow.com/a/6023847/975624 just in case the file is ever opened in Excel 2007. – gkubed Feb 01 '16 at 14:45

0 Answers0