'Google Apps Script : load specific columns of CSV files from Google Drive to BigQuery

I am trying to load CSV files landing into google drive to BigQuery, I have an automated Apps Script process to Identify a particular CSV file landing into google drive and load it to respective BigQuery table. Recently I started getting files with 41 columns and apps script is not able to load it to BigQuery, it doesn't throw any specific error but doesn't load anything to BigQuery. After testing multiple scenarios I could find that it will not load to BQ because the number of columns is more than 26. I have only 1st 10 columns in the csv that are useful so, I need to cut the columns to 10 and load those 10 columns to BigQuery. I am a bit new to apps script and tried multiple options to make it work but am not able to cut the csv and load the specific columns to BigQuery. Any suggestions or refrences are welcome.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source