Sub topic 1
Four ways to get a file's data into Google Sheets
You can bring data from an Excel workbook or a delimited text file into Google Sheets in four ways. Each suits a different job.
Prerequisites
This chapter assumes you know basic Google Sheets use (cells, rows, columns, and sheets), that you can upload files to Google Drive, and that you know what a CSV file and an Excel workbook are.
The four methods
- File > Import: upload a file from your computer and choose where its data goes. Use this for one-off imports.
- Opening from Google Drive: open an uploaded Excel file and convert it to a Google Sheets file.
- The IMPORTDATA function: pull a public CSV file from a URL into a sheet with a formula.
- An Apps Script function: read a CSV file stored in Drive and write it into a sheet. Use this for repeated imports.
Which file formats Google Sheets can import
File > Import accepts .xlsx, .xls, .csv, .tsv, .txt, and .ods files. A CSV (comma-separated values) file puts each row on its own line and separates fields with commas. A TSV file uses tabs instead. Excel workbooks can hold several sheets, formulas, and formatting.
| Format | Typical source | Import method |
|---|---|---|
| .xlsx, .xls | Microsoft Excel | File > Import, or open and convert |
| .csv | Database and app exports | File > Import, IMPORTDATA, Apps Script |
| .tsv, .txt | Tab or plain text exports | File > Import |
| .ods | LibreOffice Calc | File > Import |
Importing with File > Import
- Open a spreadsheet and select File > Import.
- Choose the Upload tab and select your file.
- Pick an import location. Insert new sheet(s) and Create new spreadsheet leave existing data alone. Replace current sheet and Replace data at selected cell overwrite it. Append rows to current sheet adds rows below the existing data.
- For a delimited file, set Separator type to Detect automatically, Comma, Tab, Semicolon, or Custom.
- Select Import data.
Exercise
A colleague emails you a semicolon-separated CSV file. You want it in a new sheet inside your existing spreadsheet, without changing any current data. Which import location and separator type do you choose?
Show answer
Choose Insert new sheet(s) as the import location, and set Separator type to Semicolon (or Custom, entering ;).