Search

Import CSV Data

Last Updated: Dec 28, 2022

Articles

Use this function to import the data in the given CSV file to the first worksheet of a Google Sheet and delete all the existing worksheets.

Syntax

Import CSV Data (id_or_url, csv_path, private_key, cient_email)

Parameters

Input Parameter Name Description
id_or_url ID or URL of Google Sheet
csv_path CSV file path to be imported in Google Sheet
private_key Private key of the service account
client_email Email ID of the service account

Returns

Return Value Description
Output
  • On Success returns 1, Worksheet Names
  • On Failure returns 0, Error Message

Sample

Import CSV Data (ABC123, D:\Desktop\Invoice_Data.csv, —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—–, name@project-id.iam.gserviceacValues.com)

  • Uses the private key —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—– to connect to the Email ID name@project-id.iam.gserviceacValues.com, imports the data in the CSV file at D:\Desktop\Invoice_Data.csv to the first worksheet of the Google Sheet using the ID ABC123 and deletes the other worksheets.
    Returns the values Travel, Expenses, Invoice.

To view all the Google Sheets functions, click here.

Did you find what you were looking for?