Import data from a CSV file to your Google Spreadsheet

I’m trying to read a CSV file saved in my Google Drive and copy data to my Google Spreadsheet.

Imagine my CSV file’s name is “singleColumn.csv” and it is located in my Google Drive folder. If you want to get your drive folder id see here; How to find your Google Drive folder ID.

This is how my CSV file looks like;


Go to your Spreadsheet, open your Script Editor, Write functions below.

These functions will search your drive folder for given file name (singleColumn.csv) and read it. Then paste data row by row on your Spreadsheet.

Contact me if you need further improvements and changes.



2 thoughts on “Import data from a CSV file to your Google Spreadsheet

  1. Michael Collins April 18, 2018 / 2:51 am

    When I tried this it would hang up on this line:

    This is the error:
    “TypeError: Cannot call method “appendRow” of null. (line 17, file “Code”)”



    • iJay April 24, 2018 / 10:48 am

      Hey Michael,

      Sorry for the delay.

      This error is because your code cannot find the “newSheet”. In my google sheet, there is a tab called “Data from CSV”. If you can rename a sheet tab as “Data from CSV” or if you can replace below code including your sheet tab name, it should work.

      //my version
      var newSheet = ssNew.getSheetByName(“Data from CSV”);

      //your version
      var newSheet = ssNew.getSheetByName(“Your tab name goes here”);

      Let me know. 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s