How do you import CSV to Google Sheets automatically? Use Google Apps Script with DriveApp.getFoldersByName() and getFilesByType() to scan a folder, read CSV contents with Utilities.parseCsv(), and write rows to your target sheet with getRange().setValues(). This eliminates manual uploads and keeps your data synced in real time.
Wouldn't it be better if your CSV data appeared in Google Sheets automatically?
The good news: it's absolutely possible. In fact, there are multiple ways to do it—from simple no-code solutions to more technical approaches.
Let's walk through your options.
Why Auto-Import CSV?
Before we dive into the how, let's talk about why this matters:
Time savings: Manual import takes 5–10 minutes per file. Do this monthly for a year, and you've spent 60–120 minutes on data entry.
Consistency: Automated imports don't forget to upload the file or miss a month. The data flows reliably.
Real-time updates: Some automated methods update throughout the day, not just when you manually upload.
Accuracy: No human error (wrong file, duplicate uploads, missed transactions).
Scalability: If you have multiple data sources (bank, credit card, investment accounts), automation becomes invaluable.
Method 1: Google Apps Script (Free, No-Code Setup)
Google Apps Script is Google's automation tool—and it can automatically import CSV data from cloud storage (Google Drive, Dropbox, etc.) or directly from URLs.
How it works:
You upload your CSV to Google Drive or connect to a cloud service
Apps Script monitors that location for new files
When a new CSV appears, the script automatically parses it and adds rows to your Google Sheet
No manual uploads needed
Step 1: Create or open your Google Sheet
Open Google Sheets and create a new sheet or use an existing one.
Step 2: Open Apps Script
Go to Extensions → Apps Script. This opens the Apps Script editor.
Step 3: Copy the automation code
Paste this basic script:
function importCSVFromDrive() {
const folderName = "CSV_Import"; // Your Google Drive folder name
const sheetName = "Imported Data"; // Your sheet name
const folder = DriveApp.getFoldersByName(folderName).next();
const files = folder.getFilesByType(MimeType.CSV);
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
while (files.hasNext()) {
const file = files.next();
const csv = file.getBlob().getDataAsString();
const rows = csv.split('\n');
for (let i = 0; i < rows.length; i++) {
sheet.appendRow(rows[i].split(','));
}
file.setTrashed(true); // Delete file after import
}
}
function setupTrigger() {
ScriptApp.newTrigger('importCSVFromDrive')
.timeBased()
.atHour(1) // Run at 1 AM daily
.everyDays(1)
.create();
}
Step 4: Set up the trigger
Click Run next to setupTrigger
Authorize the script (grant permissions)
The script will now run daily at 1 AM, automatically importing any new CSV files
When to use this:
You're comfortable copying code into Apps Script
Your CSV is already in Google Drive or accessible via URL
You want completely free automation
You need this to run daily or weekly
Limitations:
Requires some technical setup
Requires monitoring for errors
Might need tweaking if CSV format changes
Try parsing a CSV
See Privacy in Action
Upload any CSV file to see how data is processed entirely in your browser. Nothing leaves your device.
Expertise: Written by a Google Workspace Certified Expert. For official reference, see the Google Apps Script documentation.
Frequently Asked Questions
How do I auto-import CSV to Google Sheets with Apps Script?▾
You can auto-import CSV to Google Sheets using Google Apps Script by writing a script that uses DriveApp to access a specific folder, getFilesByType() to locate CSV files, Utilities.parseCsv() to parse the data, and SpreadsheetApp to write the rows into your target sheet. Set up a time-based trigger to run the script daily for fully automated imports.
What is getFilesByType in Google Apps Script?▾
getFilesByType() is a method in Google Apps Script that returns all files of a specific MIME type within a folder. For CSV automation, you use getFilesByType(MimeType.CSV) to iterate through CSV files in a designated Google Drive folder so your script can process each one automatically.
Can I import CSV from a specific folder automatically?▾
Yes, you can import CSV files from a specific folder automatically by using DriveApp.getFoldersByName() or getFolderById() to target the folder, then getFilesByType(MimeType.CSV) to loop through CSV files. Combine this with a time-based trigger so the script runs at scheduled intervals without manual intervention.
How do I schedule automatic CSV imports in Google Sheets?▾
You schedule automatic CSV imports by creating a time-based trigger in Google Apps Script using ScriptApp.newTrigger(). Set it to run daily or hourly, and point it to your import function. Once authorized, the trigger will execute automatically, scanning your folder and importing new CSV data on schedule.