I am very familiar with Excel but not so much with generating Excel documents via 4GL, but I'll risk an answer anyhow:
I suspect that you are creating text-based files for Excel (ie., non-binary or non-XLS format). Simply adding commas will not create separate columns.
A couple things you could try:
- If the generated file is indeed text (ie., you can open it with Notepad) then, make sure the extension of the filename is
CSV
, like c:\mypath\MyFile.csv
.
When a file with a .csv
extension is opened in Excel, it will separate commas into columns.
Example:
1) Open NOTEPAD.EXE
2) Copy/Paste in this text:
This is my CSV File called: myFile.csv
This is column A,and this is column B, column C,D,E,F
If I need to include a comma in the text,"I wrap it, in quotes, in the CSV file."
A,B,C,D,E,F,G
3) Save the file with name: myFile.csv
4) Close the file and then double-click† to open it.
†(If Excel isn't associated with the .CSV
file type type on your system, you may need to open Excel and then open the CSV file from within Excel.)

Excel won't AutoFit the columns (or allow any other formatting) in a CSV
file but double-clicking between column heads will AutoFit.

Another option, instead of using commas, use Tab characters (ASCII Code 9). Excel may also recognize tabs as a column-separator.