The CSV/XLSX custom field extension allows you to fetch content from a CSV or an XLSX file and displays it into a field in your content type of your stack. Thus, while creating entries, you can have a CSV or an XLSX file imported as the input value for the field.

This step-by-step guide explains how to create a CSV/XLSX custom field extension for your content types in Contentstack. The steps performed are as follows:

  1. Add the CSV/XLSX custom field extension to your stack
  2. Use your custom field


  1. Add the CSV/XLSX Custom Field Extension to your Stack

    Log in to your Contentstack account and perform the following steps:

    1. Go to your stack and click on the “Settings” icon on the left navigation panel.
    2. Click on Extensions.
    3. On the Extensions page, click on the + New Extension button and then on Create new as shown below: CSV_XLSX_1_Highlighted.png

    4. On the Select Extension Type screen, select Custom Field. CSV_XLSX_2_highlighted.png

    5. On the Create New Extension page, enter details in the fields as given below:
      1. Title: Provide a suitable title. For example, “CSV.”
      2. Field data type: Select the data type in which the input data of the field should be saved in Contentstack. Select JSON in this case.
      3. Multiple: Keep this unchecked.
      4. Hosting method: The hosting method will be set to Hosted By Contentstack.
      5. Extension Source Code: In this field, you need to enter the extension code. To get the code, contact our Support team.
        Once it is downloaded, copy the code from the index.html file located in the root folder and paste it in the Extension source code field.
      6. Config Parameter: Enter the following configuration details as the extension's config parameter:
            "columns_limit": ,
        The integer value that you enter in the above config will put a limit to the number of rows and columns that the imported file will display.

    6. Click on Save. This creates your custom field.

    Now, let's understand how you can start using this custom field in your content type.

  2. Use Your Custom Field

    Once you have added a custom field, you can use it in your content type like any other field. To add a custom field in your content type, perform the following steps:

    1. Create a content type and add the Custom field to it.

    2. Under Select Extension, select the “CSV” field that you created and set the other properties. You can add other fields as per requirements. 

    3. Finally, click on either Save or Save and Close to save your changes.
    4. Next, create an entry for this content type, and click on the Select CSV/XLSX File To Import button. CSV_XLSX_4_highlighted.png
    5. It will then prompt you to choose the CSV or the XLSX file and import it to your field. Once you add your file, this is how it appears in your entry: CSV_XLSX_5_no_highlight.png
    6. You can add or delete rows by clicking on the + or the "trash" icon respectively.

Note: The max file size that can be imported in the field extension is 10 KB. Refer to our Extension Limitation doc for more details.

Was this article helpful?