Transfer Data from Excel to SAS xpt

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Excel Add-In for SASxpt

The SASxpt Excel Add-In is a powerful tool that allows you to connect with SAS xpt (XPORT) data files directly from Microsoft Excel.

Use Excel to read, write, and update SAS xpt (XPORT) data files. Perfect for mass imports / exports / updates, data cleansing & de-duplication, Excel based data analysis, and more!



This article explains how to transfer data from Excel to SAS xpt using the Excel Add-In for SAS xpt.

The CData Excel Add-In for SAS xpt enables you to edit and save SAS xpt data directly from Excel. This article explains how to transfer data from Excel to SAS xpt. This technique is useful if you want to work on SAS xpt data in Excel and update changes, or if you have a whole spreadsheet you want to import into SAS xpt. In this example, you will use the SampleTable_1 table; however, the same process will work for any table that can be retrieved by the CData Excel Add-In.

Establish a Connection

If you have not already done so, create a new SAS xpt connection by clicking From SAS xpt on the ribbon.

Connecting to Local SASXpt Files

You can connect to local SASXpt file by setting the URI to a folder containing SASXpt files.

Connecting to S3 data source

You can connect to Amazon S3 source to read SASXpt files. Set the following properties to connect:

  • URI: Set this to the folder within your bucket that you would like to connect to.
  • AWSAccessKey: Set this to your AWS account access key.
  • AWSSecretKey: Set this to your AWS account secret key.
  • TemporaryLocalFolder: Set this to the path, or URI, to the folder that is used to temporarily download SASXpt file(s).

Connecting to Azure Data Lake Storage Gen2

You can connect to ADLS Gen2 to read SASXpt files. Set the following properties to connect:

  • URI: Set this to the name of the file system and the name of the folder which contacts your SASXpt files.
  • AzureAccount: Set this to the name of the Azure Data Lake storage account.
  • AzureAccessKey: Set this to our Azure DataLakeStore Gen 2 storage account access key.
  • TemporaryLocalFolder: Set this to the path, or URI, to the folder that is used to temporarily download SASXpt file(s).

Retrieve Data from SAS xpt

To insert data into SAS xpt, you will first need to retrieve data from the SAS xpt table you want to add to. This links the Excel spreadsheet to the SAS xpt table selected: After you retrieve data, any changes you make to the data are highlighted in red.

  1. Click the From SAS xpt button on the CData ribbon. The Data Selection wizard is displayed.
  2. In the Table or View menu, select the SampleTable_1 table.
  3. In the Maximum Rows menu, select the number of rows you want to retrieve. If you want to insert rows, you need to retrieve only one row. The Query box will then display the SQL query that corresponds to your request.
  4. In the Sheet Name box, enter the name for the sheet that will be populated. By default the add-in will create a new sheet with the name of the table.

Insert Rows to SAS xpt

After retrieving data, you can add data from an existing spreadsheet in Excel.

  1. In a cell after the last row, enter a formula referencing the corresponding cell from the other spreadsheet; for example, =MySampleTable_1SheetInExcel!A1.
  2. After using a formula to reference the cells you want to add to SAS xpt, select the cells that you are inserting data into and drag the formula down as far as needed. The referenced values you want to add will be displayed on the SampleTable_1 sheet.
  3. Highlight the rows you want to insert and click the Insert Rows button.

As each row is inserted, the Id value will appear in the Id column and the row's text will change to black, indicating that the record has been inserted.