To enjoy all our Developer Portal features, please switch to Microsoft Edge, Google Chrome or Mozilla Firefox browsers.

How to upload videos on Dailymotion via an Excel file?

Posted on by Julie Lambert

Our REST API allows “Mass Upload” for partners who need to send a large video catalog on Dailymotion. One of the easiest ways to do it is to upload files via an Excel file. Follow this tutorial to know how to use a Python library that will automatically upload your videos.

Step 1. Creation of the Excel file

First step: create your Excel file. This very simple document must include specific information about your videos:

  • Titles
  • URLs
  • Tags
  • Channels
  • Descriptions
  • Is it already published? (true/false)

Here is an Excel template that you can use to list the videos you want to upload via Dailymotion’s API:

Step 2. Integration of the library in Python code

Now that your Excel file is created, you need to integrate it in your Python code. For that, we suggest you to use Openpyxl. This open-source Python library can read and write Excel 2010 xlsx, xlsm, xltx and xltm files.

Code sample

# Import the dailymotion sdk
import importlib

# Import `load_workbook` module from `openpyxl`
from openpyxl import load_workbook

# It's imported that way due to the "-" in the module name :/
_DAILYMOTION = importlib.import_module("dailymotion-sdk-python.dailymotion")

# dailymotion credentials
_API_KEY = "YOUR_API_KEY"
_API_SECRET = "YOUR_API_SECRET"
_USERNAME = "YOUR_DAILYMOTION_LOGIN"
_PASSWORD = "YOUR_DAILYMOTION_PASSWORD"

# Loading the workbook
_FILENAME = "Videos.xlsx"
_XLS = load_workbook(_FILENAME)

# Change your sheet name if necessary
_SHEET = _XLS.get_sheet_by_name("Sheet1")

# Adding some info returned by the API on the sheet
_DM_XID = _SHEET.cell(
    row=1, column=_SHEET.max_column + 1, value="Dailymotion xid"
)
_DM_URL = _SHEET.cell(
    row=1, column=_SHEET.max_column + 1, value="Dailymotion link"
)

# Instanciating the sdk
_DM = _DAILYMOTION.Dailymotion()

try:

    # Providing the authentication information
    _DM.set_grant_type(
        "password",
        api_key=_API_KEY,
        api_secret=_API_SECRET,
        scope=["manage_videos"],
        info={"username": _USERNAME, "password": _PASSWORD},
    )

    # Looping into the rows and skiping the headers
    for row in _SHEET[2 : _SHEET.max_row]:

        # Uploading the file on dailymotion servers
        url = _DM.upload(row[1].value)

        # Filling the information about the video
        parameters = {
            "url": url,
            "title": row[0].value,
            "tags": row[2].value,
            "channel": row[3].value,
            "description": row[4].value,
            "published": row[5].value,
        }

        # Sending the information to create the video on dailymotion
        result = _DM.post("/me/videos?fields=id,url", parameters)

        # write the xid returned by the API
        _DM_XID = _SHEET.cell(
            row=_DM_XID.row + 1, column=_DM_XID.column, value=result["id"]
        )
        _DM_URL = _SHEET.cell(
            row=_DM_URL.row + 1, column=_DM_URL.column, value=result["url"]
        )

    print("Upload from excel file to dailymotion finished")
    _XLS.save(_FILENAME)

except Exception as e:
    print("An error occured: %s" % str(e))

With this code, our Python SDK will upload your videos to Dailymotion according to the information you added in the Excel file. The upload time will mostly depend on your file size. To help you keep track of the process, you will receive a script every time a new video is uploaded.

Note that API rate limits caps the number of videos you can upload per day. To check your current limits at the video level, you can request the limits field on your own user using the API: /me?fields=limits(authentication is required here).

To upload a larger video catalog, please contact your content manager.


  • More info on the other “Mass Upload” options here.