Refresh connected (imported) data
A cell range, Excel table, PivotTable report, or PivotChart report can all be connected to an external data source . You can refresh the data to update data from this external data source. Each time you refresh data, you see the most recent version of the information in the data source, including any changes that were made to the data.
Security Connections to external data may be currently disabled on your computer. To refresh data when you open a workbook, you must enable data connections by using the Trust Center bar, or put the workbook in a trusted location. For more information, see Create, remove, or change a trusted location for your files, Add, remove, or view a trusted publisher, and View my security settings in the Trust Center.What do you want to do?
Automatically refresh data when a workbook is opened
Refresh multiple external data ranges
Refresh data in an imported text file
Automatically refresh data at regular time intervals
Require a password to refresh an external data range
Run a query in the background or while you wait
Check the status of or cancel a refresh operation
Automatically refresh data when a workbook is opened
You can refresh an external data range automatically when you open the workbook, and optionally save the workbook without saving the external data, so that the workbook file size is reduced.
- Click a cell in the external data range.
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickConnection Properties.
- Click the
Usagetab. - Select the
Refresh data on file opencheck box. - If you want to save the workbook with the query definition but without the external data, select the
Remove external data from query table before saving worksheetcheck box.
Note To refresh data when the workbook is opened for a PivotTable report, you can also use the Refresh data when opening the file check box under the PivotTable Data section on the Data tab of the PivotTable Options dialog box. For more information, see PivotTable options.
Refresh multiple external data ranges
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickRefresh All.
If you have more than one workbook open, you must click Refresh All in each workbook to refresh external data.
Refresh data in an imported text file
- Select the worksheet with the imported text file.
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickRefresh. - In the
Import Text Filedialog box, select your text file, and then clickImport.
Automatically refresh data at regular time intervals
- Click a cell in the external data range.
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickConnection Properties.
- Click the
Usagetab. - Select the
Refresh everycheck box, and then enter the number of minutes between each refresh operation.
Require a password to refresh an external data range
Stored passwords are not encrypted and not recommended. If your data source requires a password to connect to it, you can require that the password is entered before the external data range can be refreshed. This procedure does not apply to data retrieved from a text file (*.txt) or a Web query (*.iqy).
- Click a cell in the external data range.
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickConnection Properties.
- Click the
Definitiontab. - Clear the
Save passwordcheck box.
Note Microsoft Office Excel prompts for the password only the first time that the external data range is refreshed in each Excel session. The next time that you start Excel, you will be prompted for the password again if you open the workbook that contains the query and attempt a refresh operation.
Run a query in the background or while you wait
Running a query in the background enables you to use Excel while the query runs.
Note You cannot run an OLAP query in the background.
- Click a cell in the external data range.
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickConnection Properties.
- Click the
Usagetab. - Select the
Enable background refreshcheck box to run the query in the background. Clear this check box to run the query while you wait.
Notes:
- Stop a query To stop a query from running when
Enable background refreshis turned off, press ESC. - Stop a background refresh To stop a query that is running in the background, double-click the
Background Refresh
icon on the status bar to display the External Data Refresh Statusdialog box, and then clickStop Refresh. - Recording a macro While you are recording a macro that includes a query, Excel will not run the query in the background. To change the recorded macro so that it runs in the background, edit the macro in the Visual Basic Editor and change the refresh method for the QueryTable object from "BackgroundQuery := False" to "BackgroundQuery := True". For information about editing macros, see Visual Basic Help .
Check the status of or cancel a refresh operation
- To check the status of a refresh, double click
Background Refresh
on the status bar.
-
To cancel the query, press ESC.
Refresh an offline cube file
Refreshing an offline cube file, which re-creates it with the most recent data from the server cube, can be time consuming and require a lot of temporary disk space. Start the process at a time when you do not need immediate access to other files, and make sure that you have adequate disk space to save the file again.
- Click the PivotTable report that's based on the offline cube file.
- On the
Datatab, in theConnectionsgroup, click the arrow next toRefresh, and then clickRefresh.
See also:
- Connect to (import) an OLAP database
- Connection properties
- Create, edit, and manage connections to external data
- Data sources that you can access
- Exchange (copy, import, export) data between Excel and Access
- Import or export text files
- Remove the data connection from an external data range
- Use Microsoft Query to retrieve external data