# Importing Sheets

SheetRest allows you to import data from Google Spreadsheets, local files and custom sheets created from scratch.

# Preparing the data

When importing the data, SheetRest will use the first row of the spreadsheet as a header. It means that the first row should contain the names of the columns. Rest of the rows will be considered as data.

For example, this is a valid spreadsheet:

After importing this spreadsheet and querying the data, you will get the following JSON:

[
  {
    "id": 1,
    "Name": "Bob",
    "Birth Date": "12/19/1980",
    "Score": 86
  },
  {
    "id": 2,
    "Name": "Alice",
    "Birth Date": "4/21/1981",
    "Score": 37
  },
  {
    "id": 3,
    "Name": "John",
    "Birth Date": "12/1/1990",
    "Score": 48
  },
  {
    "id": 4,
    "Name": "Alex",
    "Birth Date": "12/21/1990",
    "Score": 33
  },
  {
    "id": 5,
    "Name": "Max",
    "Birth Date": "12/23/1990",
    "Score": 93
  },
  {
    "id": 6,
    "Name": "Harry",
    "Birth Date": "4/15/1992",
    "Score": 51
  }
]

# Google Spreadsheets

In this section we'll cover how to import data from Google Spreadsheets.

# Configure permissions

In order to import data from Google Spreadsheet first you need to setup proper permissions so Sheets run can access your spreadsheets.

If you want to enable reading data, you'll need to make your sheet accessible to anyone with the link. You can do it by clicking on the "Share" button in the top right corner of your spreadsheet.

You can open the "Share" setting by clicking on the "Share" button in the top right corner of your spreadsheet.

And then make sure you have "Anyone with the link" option selected.

If you want to also enable writing data via POST / PUT / DELETE requests, you need to add Sheets run as an editor, In order to do it, you need to invite [email protected] user to your spreadsheet (this is our robot account used to minimize the access scope).

# Importing the spreadsheet

Importing the spreadsheet is as simple as providing the spreadsheet URL. You can find the URL in the browser address bar.

First, you need to open the spreadsheet in the browser and copy the url.

Once you have the URL, navigate to the Dashboard and click "Add new Spreadsheet". Make sure "Google Sheet" tab is selected. Paste the URL and click "Next button".

Wait until your spreadsheet information is imported. You should see 2 additional inputs: Name and Sheet. Name will be used in the dashboard to reference your need spreadsheet. Sheet is the name of the sheet in your spreadsheet. If you have multiple sheets in your spreadsheet, you can select the one you want to import.

After you added the desired name and selected the tab, click "Add Sheet" and wait for import to finish.

And that's it! 🎉 You can now find the added sheet on the main page of the dashboard and query your data. See the rest of the documentation for more details on how to use REST API.

# Local files

You can create an API from a local file. You can upload a CSV or XLSX file. The file will be imported and you can query the data using REST API.

The importing process is very similar to importing Google Spreadsheets. You need to navigate to the Dashboard and click "Add new Spreadsheet". Make sure "File Upload" tab is selected. Specify the desired name, select the file you want to import and click "Add Sheet".

And that's it! 🎉 You can now find the added sheet on the main page of the dashboard and query your data. See the rest of the documentation for more details on how to use REST API.

# Starting from scratch

You can also create a new sheet from scratch. You can add columns and rows using the dashboard and then work with the data using REST API. Later you can export the data to Google Spreadsheet or download it as a CSV file.

To create a new sheet, navigate to the Dashboard and click "Add new Spreadsheet". Make sure "From Scratch" tab is selected. Specify the desired name, column names and click "Add Sheet".

And that's it! 🎉 You can now find the added sheet on the main page of the dashboard and query your data. See the rest of the documentation for more details on how to use REST API.