How to set size of column of csv file?

You can't... a CSV file has no formatting of any kind, including column size.

If you want to control column widths, then you need to write the data to a format that does support columns widths, such as BIFF (.xls) or OfficeOpenXML (.xlsx) or OASIS Open Document Format (.ods) or Gnumeric or other spreadsheet.


There is no way to do this.
CSV stands for coma separated values:

A comma-separated values (CSV) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal comma or tab. Usually, all records have an identical sequence of fields.

Short and clear definition.
CSV is too primitive for this.
Did you ever try to open CSV file with usual text editor?
You need XLS for this case.

Tags:

Php

Excel