Links

Importing data from flat files

Workspace features a library of curated datasets ready for you to analyze, but it is also possible to work with your own data files, be it CSV, Excel, text, geospatial, etc. data files. In this article, we'll assume that the data file you want to work with in Workspace is on your computer. The first step is uploading the file to Workspace, the next step is loading the data file into your notebook session.

Uploading the data file

  • Click the
    icon in the left sidebar to open the file browser.
  • To upload the data file, you have several options:
    • Click the
      icon in the top right of the file browser tab and click Upload. Select the file from your local filesystem and confirm.
    • Click on "Browse files" in the dashed rectangular box in the file browser. Select the file from your local filesystem and confirm.
    • Drag the file from a file browser (Windows) or Finder (Mac) window into the file browser pane.

Loading the data file into your notebook session

Now that you have uploaded to file to your workspace, you can load it into your session so you can start analyzing it.
First, copy the file path to your clipboard by clicking the
icon next to your data file and selecting "Copy path to clipboard".
Second, add a new code cell to your notebook file and add one of the following code snippets depending on the file format or the language you're using. Note that you may need to tweak this function call to deal with the specifics of your file (e.g. to skip rows, to specify the column names, etc). Replace example.csv with the file path you copied to your clipboard in the first step.
File Type
Python
R
CSV
import pandas as pd pd.read_csv('example.csv')
import readr read_csv('example.csv')
Excel
import pandas as pd pd.read_excel('example.xlsx')
import readxl read_excel('example.xlsx')
Finally, run the code cell. The data contained in the file will now be available as a dataframe df that you can start analyzing.

Shortcut for CSV files

Specifically for CSV files, there is a faster way: click the
icon next to the file you want to import and select "Load as DataFrame". A new code cell will be added to your notebook with the appropriate Python or R code.
"Load as DataFrame" is a quick way to import a CSV file into your notebook