Create CSV-Connected Applications in Appsmith

Cameron Leblanc
Cameron Leblanc
Senior Technology Evangelist
Connect to CSV Data via CData Connect AI in Appsmith and create custom business applications with real-time access to CSV data.

Appsmith is an open-source internal tool builder that allows teams to quickly and easily build a UI to help improve their business operations. When combined with CData Connect AI, you gain immediate access to CSV data for business applications. This article outlines the process of connecting to CSV using Connect AI and creating a basic application from CSV data within Appsmith.

CData Connect AI offers a pure SQL Server, cloud-to-cloud interface for CSV, enabling the creation of business applications directly from live CSV data within Appsmith, all without the need for data replication to a native database. As you build applications, Appsmith generates SQL queries to gather data. With its inherent optimized data processing capabilities, CData Connect AI efficiently channels all supported SQL operations, including filters and JOINs, directly to CSV. This leverages server-side processing to swiftly deliver the requested CSV data.

Configure CSV Connectivity for Appsmith

Connectivity to CSV from Appsmith is made possible through CData Connect AI. To work with CSV data from Appsmith, we start by creating and configuring a CSV connection.

  1. Log into Connect AI, click Sources, and then click Add Connection
  2. Adding a Connection
  3. Select "CSV" from the Add Connection panel
  4. Selecting a data source
  5. Enter the necessary authentication properties to connect to CSV.

    Connecting to Local or Cloud-Stored (Box, Google Drive, Amazon S3, SharePoint) CSV Files

    CData Drivers let you work with CSV files stored locally and stored in cloud storage services like Box, Amazon S3, Google Drive, or SharePoint, right where they are.

    Setting connection properties for local files

    Set the URI property to local folder path.

    Setting connection properties for files stored in Amazon S3

    To connect to CSV file(s) within Amazon S3, set the URI property to the URI of the Bucket and Folder where the intended CSV files exist. In addition, at least set these properties:

    • AWSAccessKey: AWS Access Key (username)
    • AWSSecretKey: AWS Secret Key

    Setting connection properties for files stored in Box

    To connect to CSV file(s) within Box, set the URI property to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect to Box.

    Dropbox

    To connect to CSV file(s) within Dropbox, set the URI proprerty to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect to Dropbox. Either User Account or Service Account can be used to authenticate.

    SharePoint Online (SOAP)

    To connect to CSV file(s) within SharePoint with SOAP Schema, set the URI proprerty to the URI of the document library that includes the intended CSV file. Set User, Password, and StorageBaseURL.

    SharePoint Online REST

    To connect to CSV file(s) within SharePoint with REST Schema, set the URI proprerty to the URI of the document library that includes the intended CSV file. StorageBaseURL is optional. If not set, the driver will use the root drive. OAuth is used to authenticate.

    Google Drive

    To connect to CSV file(s) within Google Drive, set the URI property to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect and set InitiateOAuth to GETANDREFRESH.

    Configuring a connection (Salesforce is shown)
  6. Click Save & Test
  7. Navigate to the Permissions tab in the Add CSV Connection page and update the User-based permissions. Updating permissions

Add a Personal Access Token

When connecting to Connect AI through the REST API, the OData API, or the Virtual SQL Server, a Personal Access Token (PAT) is used to authenticate the connection to Connect AI. It is best practice to create a separate PAT for each service to maintain granularity of access.

  1. Click on the Gear icon () at the top right of the Connect AI app to open the settings page.
  2. On the Settings page, go to the Access Tokens section and click Create PAT.
  3. Give the PAT a name and click Create. Creating a new PAT
  4. The personal access token is only visible at creation, so be sure to copy it and store it securely for future use.

With the connection configured and a PAT generated, we are ready to connect to CSV data from Appsmith.

Create an Appsmith Application from live CSV Data

To establish a connection from Appsmith to the CData Connect AI Virtual SQL Server, follow these steps:

Connect to CSV in Appsmith

  1. Log in to your Appsmith instance and create a new application.
  2. In the new application, open the Data page and select Bring your data. Open the Data page
  3. On this page, you can search for Microsoft SQL Server and select it as your data source. Select Microsoft SQL Server datasource
  4. Enter a name for the new data source and then enter the following connection settings:
    • Host address: tds.cdata.com
    • Port: 14333
    • Database name: enter the Connection Name of the CData Connect AI data source you want to connect to (for example, CSV1).
    • Username: enter your CData Connect AI username. This is displayed in the top-right corner of the CData Connect AI interface. For example, [email protected].
    • Password: enter the PAT you previously generated.
    • Configure the connection to the Connect AI Virtual SQL Server (Salesforce shown)
  5. Click Test configuration to confirm a successful connection, then click Save to save the datasource.

Create a new query

With a connection configured to a datasource, we can add a SQL query to actually retrieve data from the data source.

  1. On the screen with the new data source, click New Query. Create a New Query
  2. This opens the Query Editor to enter a SQL query to select data. To assist with specifying a SQL query, use the Explorer of CData Connect AI to preview the SQL queries and the data you want to retrieve. Preview queries in the Explorer
  3. After creating the SQL query, return to the Query Editor in Appsmith and enter the SQL query, then click Run. Run the SQL query
  4. Once the query successfully runs, all that remains is to set up the Page to display the data retrieved.

Display CSV data

  1. Open the UI tab and click New UI element. New UI element
  2. Choose a new UI element to grab, then drag and place the element on the page. New UI element
  3. Click Connect data on the new UI element, then select the query previously created. Connect to data
  4. With the data connected, it is then displayed in the UI element. UI element connected

Deploy the application

With the CSV data connected to the UI elements in the application, we can deploy the Application. To do this, click Deploy in the top-right corner of Appsmith, then the application is opened in a separate window displaying the CSV data.

Application deployed

Get CData Connect AI

To get live data access to hundreds of SaaS, Big Data, and NoSQL sources directly from your cloud applications, try CData Connect AI today!

Ready to get started?

Learn more about CData Connect AI or sign up for free trial access:

Free Trial