On Tue, Dec 23, 2014 at 8:36 AM, Smith, Mike
<Mike_Smith@xxxxxxxxxxxxxxxx> wrote:
I'm creating a file for HSA contributions and the instructions said to use a .CSV file. When the requesting user opened the template file it had Headings, although it did open in Excel.
I might need to double check this and make sure it truly is a .CSV file they need.
CSV files can and routinely do have headings. What Vern was trying to
say is that from a "CSV mechanics" standpoint, headings are just like
any other row, but from a "database table" standpoint, headings are
special because the content is always character, no matter what the
data type of the columns being labeled by those headings.
In a database table (or physical file), the column headings are
*metadata*. They don't live *in* any row of the data. But in a CSV
file, every single row is a data row. On the other hand, there are no
(enforceable) data types in a CSV file.
The potential gotcha that Vern was trying to point out is that you
might have to generate the CSV header row separately from the other
rows. In other words, you might not be able to just "dump" a table
into a CSV, because the headings wouldn't be in the table to begin
with. (And you couldn't just throw the data into the table yourself,
because of the potentially conflicting data types.) The normal way to
write a CSV is to write a row of headings first (could be hard-coded
if need be, but preferably would grab the column heading information
from the table), and then append the data from the table.
John Y.
As an Amazon Associate we earn from qualifying purchases.