The IMPORTCSV function allows you to import data from a CSV file directly into Excel. It provides a simplified way to bring in comma-delimited data as a dynamic array, with options to skip or take rows and apply locale settings for regional formatting.
Note: This feature is currently generally available to Microsoft 365 subscribers enrolled to the Insiders Beta channel, running Version 2502 (Build 18604.20002) or later in Excel for Windows.
Syntax
The IMPORTCSV function imports data from a CSV file into Excel as a dynamic array.
The syntax of the IMPORTCSV function is:
IMPORTCSV(path, [skip_rows], [take_rows], [locale])
|
Argument |
Description |
|---|---|
|
path (required) |
The local file path or URL of the CSV file you want to import. |
|
skip_rows |
A number that specifies how many rows to skip. A negative value skips rows from the end of the array. |
|
take_rows |
A number that specifies how many rows to return. A negative value takes rows from the end of the array. |
|
locale |
Determines regional formatting (e.g., date, number formats). By default, the OS locale is used. |
Notes:
-
Import Functions do not automatically refresh. To update imported data, use the Refresh All button on the Data tab.
-
The IMPORTCSV function is a simplified version of IMPORTTEXT that expects comma delimiters and UTF-8 encoding. For more flexibility, including support for multiple delimiters, encoding, and fixed-width columns, see IMPORTTEXT function.
When importing a file from the web, you may need to provide credentials or sign in to access the source file. In such cases, you will be prompted to select the authentication method to use for the provided URL through an authentication dialog.
The available authentication methods are:
-
Anonymous: Select this authentication method when the content is publicly accessible and doesn’t require sign-in.
-
Windows: Select this authentication method when accessing a resource that requires your Windows credentials.
-
Basic: Select this authentication method when the resource requires a username and password.
-
Web API: Select this method if the web resource that you're connecting to uses an API Key for authentication purposes.
-
Organizational account: Select this authentication method if the resource requires organizational account credentials.
To clear permissions given during the authentication process, click on Data > Get Data > 'Data Source Settings...'. Then, under the 'Global Permissions' tab, select the relevant URL path and click on 'Clear Permissions'
Examples
The following examples are based on a fictitious text file path: "C:\Data\example.csv".
Return the first two rows from the source file
|
Data |
||||||||||||
|
||||||||||||
|
Formulas |
||||||||||||
|
=IMPORTCSV("C:\Data\example.csv",,2) |
The following illustration shows the result:
Skip the first row from the source file
|
Data |
||||||||||||
|
||||||||||||
|
Formulas |
||||||||||||
|
=IMPORTCSV("C:\Data\example.csv",1) |
The following illustration shows the result: