IMPORTCSV function
IMPORTCSV loads a CSV file into the sheet with a formula and returns the contents as a spilled array that refreshes when recalculated. Wrap it in DROP to remove the header row.
Example
=IMPORTCSV("C:\data\sample.csv")
Expected result: n/a Not yet checked in desktop Excel
Syntax
IMPORTCSV(path, [skip_rows], [take_rows], [encoding], [locale])
Arguments in [square brackets] are optional.
-
path(required) - Path or URL of the CSV file.
-
skip_rows(optional) - Rows to skip at the start.
-
take_rows(optional) - Maximum rows to return.
-
encoding(optional) - Text encoding of the file.
-
locale(optional) - Locale for interpreting numbers and dates.
Returns: The CSV contents as a spilled array.
One IMPORTCSV formula can fill more than one cell. When the result has several values, they spill into the cells below or to the right of the formula.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=IMPORTCSV("C:\data\import-sample.csv") | Name | Local CSV file |
=IMPORTCSV("C:\nope\missing.csv") | #VALUE! | Missing file |
=IMPORTCSV("abc") | #VALUE! | Not a path |
Watch out for
- Argument list is from early announcements; confirm in the formula tooltip.
- Everything is returned as an array, so wrap in DROP to remove headers.
Where it works
- Excel
- IMPORTCSV is only in Excel for Microsoft 365 and Excel for the web. Very recent 365 addition, possibly still rolling out; unsure of final argument names, so verify in your build.
- Google Sheets
- Done with a different function: `IMPORTDATA`. IMPORTDATA(url) reads CSV from a URL.
Part of Lookup and reference functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .