Home  >  Q&A  >  body text

Create multiple tables using fputcsv

If you have a single block of data, using fputcsv to create the table works well; it assumes the first row is the header and subsequent rows have the same format.

But what if you have multiple chunks of data in different formats that you want to write to CSV:

Business Name: name-of-business.   Date: current date

Notes: single line of notes


Model | Product 
model1 | Product 1
model2 | Product 2
model3 | Product 3

The first row is basically a single row table with 4 columns and no headers The second row is a single row table with 2 columns and no headers Then comes the data - a typical two-column table with headers

P粉704196697P粉704196697176 days ago297

reply all(1)I'll reply

  • P粉393030917

    P粉3930309172024-03-31 14:19:45

    Upon request:

    You will then have your own CSV-specific definitions...but that's not what I expect from CSV, so don't blame others if they can't understand your CSV :)

    There is an RFC for CSV, and I guess there is nothing more to expect from CSV than what is commented there.

    reply
    0
  • Cancelreply