Data Import & Export

Import Data from a Password-Protected Access Database into Excel

Ayan MasoodAyan Masood Nov 25, 2026 870 views

Question details

Import a table from a password-protected Access database into Excel when the Get Data connection does not prompt for the database password.

Import Data from a Password-Protected Access Database into Excel
Product
Microsoft Excel and Microsoft Access
Device & OS
not provided
Scenario
The user wants to retrieve data from an encrypted Access database into an Excel worksheet.
Observed behavior
Excel's Get Data connection may fail without offering a prompt for the Access database password.
Before you start

Confirm the database file path, database password, and name of the table to import. For the VBA method, check that a compatible Microsoft Access Database Engine provider is installed and matches the bitness of Excel.

Solution 1Recommended

Import the Access table with an ACE OLE DB connection in Excel

Use Excel VBA to supply the database password in a connection string and copy a table into the active worksheet.

This example uses late binding, so you do not need to add an ADO reference in the VBA editor. It writes field names to row 1 and data beginning in row 2 of the active worksheet.

1
Open the VBA editor

In Excel, select the worksheet where you want the data, press Alt+F11, and choose Insert > Module.

2
Add the import macro

Paste this macro into the module, then replace the file path and TableName with your database path and table name: Sub ImportAccessTable() Dim cn As Object, rs As Object Dim dbPassword As String, i As Long Dim ws As Worksheet Set ws = ActiveSheet dbPassword = InputBox("Enter the Access database password:") If dbPassword = "" Then Exit Sub Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _ "Data Source=D:\Stocks.accdb;" & _ "Jet OLEDB:Database Password=" & dbPassword & ";" rs.Open "SELECT * FROM [TableName]", cn For i = 0 To rs.Fields.Count - 1 ws.Cells(1, i + 1).Value = rs.Fields(i).Name Next i ws.Range("A2").CopyFromRecordset rs rs.Close cn.Close End Sub

3
Run the macro

Return to Excel, press Alt+F8, select ImportAccessTable, and click Run. Enter the database password when prompted.

Import the Access table with an ACE OLE DB connection in Excel
Protect the password: The InputBox entry is not masked, and the password is passed in the connection string. Avoid hard-coding it in a shared workbook. Passwords containing connection-string delimiters may require proper OLE DB quoting.
Free Microsoft Office alternative

Open exported Access data in WPS Spreadsheets

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. After exporting your Access data to an Excel workbook, open it in WPS Spreadsheets for a straightforward move to WPS. WPS does not resolve Excel's Access connection prompt issue.

Review and edit Access data exported to a spreadsheetCompatible with Microsoft Excel XLSX and XLS formatsFamiliar spreadsheet interface for an easier transitionFree, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel fail to connect without asking for the database password?

The Get Data connection may not present a database-password prompt for the encrypted Access file. An ACE OLE DB connection can supply the password through the Jet OLEDB:Database Password property.

What if Excel says the ACE provider is not registered?

Check that the Microsoft Access Database Engine is installed and that its bitness matches Excel. In Excel, check the installed Office bitness under File > Account > About Excel.

Can I import an Access query instead of a table?

Yes. In the VBA example, replace TableName in the SELECT statement with the name of the saved Access query, keeping the square brackets around the name.

Will the exported Excel file update when the Access data changes?

No. An Access export creates a separate copy. Run the export again to obtain updated data, or rerun the Excel VBA import.