Open Daemach opened 7 months ago
I think you're talking about readCsv() rather than readLargeFile().
The read()
method does that because a query must have column names. readCsv()
returns an array of arrays which doesn't require them. If you don't specify them then I think it's right that columns
should be empty. If you want to add them you can using the withHeader()
method:
spreadsheet.readCsv( path )
.intoAnArray()
.withHeader( [ "column1", "column2", "column3" ] )
.execute();
The header values don't have to appear in the CSV, they will still be used if not present.
When using the
read()
method, and I don't provide headers and don't specify that the first row is headers, the library returns a query with columns namedcolumn1, etc
That is convenient syntax to work with and makes the code more readable. When usingreadLargeFile
and returning a struct, it would be great if you could do the same thing with thecolumns
array.