Data Import & Export

Import CSV Data into Excel Without Creating a Query

Huma Ashraf ChHuma Ashraf Ch Nov 25, 2026 868 views

Question details

Import CSV data into an Excel worksheet without leaving a new query or workbook connection.

Import CSV Data into Excel Without Creating a Query
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to transfer CSV data into worksheet cells rather than use a persistent QueryTable or connection.
Observed behavior
The CSV data should appear as worksheet values without creating a new query connection.
Before you start

Open the destination workbook and select the worksheet where the data should go. The example writes from cell A1 and overwrites cells in the destination area; check that the area is available and that Excel's CSV parsing preserves the data types you need.

Solution 1Recommended

Use VBA to open the CSV and copy its values

Use this method to import CSV data into the active worksheet without creating a QueryTable or workbook connection.

The macro opens the CSV as a temporary workbook, transfers its used range as values, and closes it without saving. It does not remove connections that already exist in the destination workbook.

1
Open the VBA editor

In Excel, select Developer > Visual Basic, then choose Insert > Module.

2
Add the import macro

Paste this code into the module: Sub ImportCSVWithoutQuery() Dim filePath As Variant Dim destination As Worksheet Dim sourceBook As Workbook Dim sourceRange As Range Set destination = ActiveSheet filePath = Application.GetOpenFilename("CSV Files (*.csv),*.csv") If filePath = False Then Exit Sub On Error GoTo ImportError Set sourceBook = Workbooks.Open(Filename:=CStr(filePath), ReadOnly:=True, Local:=True) Set sourceRange = sourceBook.Worksheets(1).UsedRange destination.Range("A1").Resize(sourceRange.Rows.Count, sourceRange.Columns.Count).Value2 = sourceRange.Value2 sourceBook.Close SaveChanges:=False Exit Sub ImportError: If Not sourceBook Is Nothing Then sourceBook.Close SaveChanges:=False MsgBox "Import failed: " & Err.Description, vbExclamation End Sub

3
Run the macro

Return to the destination worksheet, select Developer > Macros, choose ImportCSVWithoutQuery, and click Run. Select the CSV file in the file picker.

4
Check the imported data

Review the values starting at A1. If you want to confirm that no new connection was created, open Data > Queries & Connections.

Use VBA to open the CSV and copy its values
Check data types: Excel may automatically convert CSV fields, such as dates or numbers with leading zeros, when opening the file. Test the result with your CSV before relying on the imported values.
Import CSV data with WPS

Copy CSV data into a WPS Spreadsheets workbook

Open the CSV separately in WPS Spreadsheets, then copy its data into your destination sheet instead of creating a query connection.

  1. 1. Open the destination workbook: In WPS Spreadsheets, use Open to select your destination workbook and identify the sheet and starting cell.
  2. 2. Open the CSV: Use Open again to select the CSV file. If an import dialog appears, review its delimiter and column settings before opening the data.
  3. 3. Copy the data: Select the populated cells in the CSV sheet and choose Copy.
  4. 4. Paste into the destination: Switch to the destination workbook, select the starting cell, and use Paste Special > Values if available. Check the pasted data and close the CSV without saving changes.
Transfer CSV data directly into worksheet cells without setting up a queryOpen and edit Microsoft Excel formats, including XLSX and XLSWork in a familiar spreadsheet interfaceUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Does this macro delete existing queries or connections?

No. It avoids creating a new query or connection, but existing ones remain. Review them under Data > Queries & Connections.

How can I import the CSV somewhere other than A1?

In the VBA module, change destination.Range("A1") to the desired starting cell, such as destination.Range("C5"). Make sure the destination area is clear.

Will the macro preserve leading zeros in CSV fields?

Not necessarily. Workbooks.Open lets Excel interpret the CSV, which can remove leading zeros. Use an import method that lets you set affected columns to Text if those zeros must be preserved.

Why are old values still visible below the imported data?

The macro overwrites only the area occupied by the current CSV data. If appropriate, select and clear the old destination cells before running the macro.