Function Repository Resource:

ImportSheetData

Source Notebook

Interactively import data from a spreadsheet

Contributed by: E. Chan-López & Jorge Luis Ramos Castellano

ResourceFunction["ImportSheetData"][]

creates a dialog for selecting and importing a spreadsheet.

ResourceFunction["ImportSheetData"]["filepath"]

imports the spreadsheet from the specified file.

ResourceFunction["ImportSheetData"][][property]

returns the value of a property from the sheet.

Details

ResourceFunction["ImportSheetData"] opens a system dialog to allow the user to select a spreadsheet file including Excel formats (csv, tsv, xls, xlsx, xlsb, xlsm, or ods).
After selecting an Excel file, the user is prompted to choose a sheet and the desired format for the imported data.
In addition to the Raw data format, ResourceFunction["ImportSheetData"] allows the user to choose between the following formats:
Dataa list of lists, excluding the header row
Dataseta Dataset object, including the header row
Flatteneda flattened list
Pairwisea list of pairs, where the first element is the key and the rest are values
Tabulara Tabular object, including the header row
ResourceFunction["ImportSheetData"] returns an ImportSheetData object containing both the imported data and metadata.
ResourceFunction["ImportSheetData"][][property] supports the following property values:
"Data"the data chosen in the dialog
"FileName"name of the imported file as a String
"Dimensions"dimensions of the imported data
"SheetName"name of the imported sheet
"Format"format of the imported data
"DataType"indicator of whether the imported data is a "Vector", "Matrix", or "3-Rank Array"
ResourceFunction["ImportSheetData"] uses a dynamic summary box to display the metadata in an organized and interactive way.
If the selected file is not an Excel file, ResourceFunction["ImportSheetData"] returns a message indicating that the file format is not supported.

Examples

Basic Examples (3) 

Open a system dialog box to select the spreadsheet file from which the data will be imported, then choose the sheet by name and format:

In[1]:=
mydata = ResourceFunction["ImportSheetData"][]
Out[1]=

The result is displayed with a summary box:

In[2]:=
mydata
Out[2]=

Show the data:

In[3]:=
ListPlot[mydata["Data"]]
Out[3]=

Scope (2) 

Use ImportSheetData to import data from an example file:

In[4]:=
path = FindFile["ExampleData/elements.xls"]
Out[4]=

Choose Spreadsheet1 with the Dataset option:

In[5]:=
data = ResourceFunction["ImportSheetData"][path]
Out[5]=

See the data:

In[6]:=
data["Data"]
Out[6]=

Use ImportSheetData with URLDownload to process data from a trusted online source:

In[7]:=
urlData = "https://gist.githubusercontent.com/netj/8836201/raw/6f9306ad21398ea43cba4f7d537619d0e07d5ae3/iris.csv";
localFile = FileNameJoin[{$TemporaryDirectory, "data_iris.csv"}];
URLDownload[urlData, localFile];

Import to the Tabular format:

In[8]:=
irisData = ResourceFunction["ImportSheetData"][localFile]
Out[8]=

Retrieve the Tabular data:

In[9]:=
irisData["Data"]
Out[9]=

Publisher

Ramón Eduardo Chan López

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 07 March 2025

Source Metadata

Related Resources

Author Notes

The current implementation has been enriched by the detailed feedback provided during the review process. I appreciate the time and insights from the reviewer, which have significantly improved the function's clarity and usability. Thank you for your valuable suggestions.

License Information