# Integrating with Microsoft OneDrive

[Prerequisites](#prerequisites)

[MS Admin Consent for Connecting OneDrive Accounts](#drivetrain-setup)

[Drivetrain Setup](#drivetrain-setup)\
&#x20;  [Step 1: Connect your OneDrive Account](#step-1-connect-your-onedrive-account)\
&#x20;  [Step 2: Import File to Drivetrain](#step-2-import-file-to-drivetrain)\
&#x20;  [Step 3: Add more Files to Drivetrain](#step-3-add-more-files-to-drivetrain)

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* The table you want to import should start from the first cell (A1) on the sheet
* None of the column headers should be empty
* There should only be one table per file
* Only .XLSX and .CSV files are supported
* Admin privileges in Drivetrain

&#x20;

## MS Admin Consent for Connecting OneDrive Accounts <a href="#drivetrain-setup" id="drivetrain-setup"></a>

Before a user can connect their OneDrive account, Drivetrain requires MS admin's consent from the user's Microsoft 365 organisation. This consent allows Drivetrain to access and read files from the user's OneDrive account as part of the integration.

Please use this [link](https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=e91b7619-1c8c-4455-8071-aedf6ca84954\&response_type=code\&redirect_uri=https://id.drivetrain.ai\&response_mode=query\&scope=offline_access%20Files.ReadWrite.All%20User.Read\&state=service~117) to grant the consent, once you click on this link a new tab will open and will ask you to sign with your admin account if your are not already signed in. Select **Consent on behalf of your organization** and click on **Accept,** after clicking on Accept it will redirect to you to your Drivetrain's tenant.&#x20;

<div align="left"><figure><img src="/files/WwD48OgDuzsEi2oBDruV" alt="" width="375"><figcaption></figcaption></figure></div>

## Drivetrain Setup <a href="#drivetrain-setup" id="drivetrain-setup"></a>

### **Step 1: Connect your OneDrive Account** <a href="#step-1-connect-your-onedrive-account" id="step-1-connect-your-onedrive-account"></a>

1. Click on **+** button on top left corner

<figure><img src="/files/mh4KhbOcFOV4Lwt6b7f5" alt=""><figcaption></figcaption></figure>

2. Select the OneDrive connector under Spreadsheets category

<figure><img src="/files/HdanNgnFBlXm0H8tJCYP" alt=""><figcaption></figcaption></figure>

3. On the pop-up, click **Open Window**, you will be redirected to the Microsoft login page.
4. If you're not signed into Microsoft, do that now, then select the account from which you want to import the data If you are already signed in, simply select the account from which you want to import the data.

<figure><img src="/files/vQoR6jeAOMbVsaybCrM1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/O3To0vmtNXukDIoltgaV" alt=""><figcaption></figcaption></figure>

6. Or select the account from which you want to upload the sheet if you are already signed in

<figure><img src="/files/eskEwsm1JUvxgUbm5zyh" alt=""><figcaption></figcaption></figure>

7. After a successful login, you will be redirected back to Drivetrain **Connected Integrations** page which will ask you to paste the URL of the sheet you want to import

<figure><img src="/files/CRzg7miqlO7JeQLpSamz" alt=""><figcaption></figcaption></figure>

### **Step 2: Import File to Drivetrain** <a href="#step-2-import-file-to-drivetrain" id="step-2-import-file-to-drivetrain"></a>

1. Open OneDrive and navigate to the file you want to import
2. Copy the URL of the file which needs to be imported

{% hint style="info" %}
Please copy the URL using the address bar (see below image) and not using the copy link option available in OneDrive
{% endhint %}

<figure><img src="/files/k0kCV4JHdHvUm9UtmjqP" alt=""><figcaption></figcaption></figure>

3. Paste your OneDrive File Link into the field provided and click **Add**

<figure><img src="/files/j0siekBL63yFJC8b2W9p" alt=""><figcaption></figcaption></figure>

4. Please wait for some few mins until the sync is completed, the file you added will now show up in the list of tables on OneDrive connector

<figure><img src="/files/hJFsRPPZXQBshHS1WGPL" alt=""><figcaption></figcaption></figure>

### Step 3: Add more Files to Drivetrain <a href="#step-3-add-more-files-to-drivetrain" id="step-3-add-more-files-to-drivetrain"></a>

You can add more tables by using the **Add data** option as shown below

<figure><img src="/files/H0FB5TXEws3YkRBRetah" alt=""><figcaption></figcaption></figure>

## FAQ <a href="#faq" id="faq"></a>

<details>

<summary>Can I load/refresh data from a OneDrive File?</summary>

Yes, you can connect your OneDrive Account to Drivetrain. It'll be synced (i.e, refreshed) with the changes at predefined intervals. Alternatively, you can also [trigger a manual sync](https://docs.drivetrain.ai/getting-started/data/explore-your-datasets#resync). Refer to the above guide for more details

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://integrations.drivetrain.ai/integration-guide/integrate-with-drivetrain/spreadsheets/integrating-with-microsoft-onedrive.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
