Home > Enterprise >  remove header from a CSV in Google Cloud Funciton
remove header from a CSV in Google Cloud Funciton

Time:02-12

I am Creating a CSV File from a Google Cloud Big Query Table. Since I am converting the entire table into a CSV, by default the table header name is Included in the CSV file.

This is the Code I am using for creating the CSV file

  // Export data from the table into a Google Cloud Storage file
  const [job] = await bigquery
    .dataset(datasetId)
    .table(tableId)
    .extract(storage.bucket(bucketName).file(filename), options);

  console.log(`Job ${job.id} created.`);

I have tried the following code to use to remove the header, did it doesn't work

const parser = csv({ headers : true });

Any Idea how I can remove the header from the CSV??

CodePudding user response:

There is a printHeader option in the API definition. In the NodeJS client library, you can find the definition in the IJobConfigurationExtract

So, use printHeader:false in the options object

  • Related