How to Automate Excel Imports and PivotTables Using Power Query
Question details
The user wants to automate the process of importing recurring files, removing unnecessary columns, and updating a PivotTable without manual formatting each time.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Handling recurring data imports where source files are updated regularly and need to be processed quickly into a formatted PivotTable.
- Observed behavior
- Currently, importing data and applying identical formatting and PivotTable updates requires repetitive manual effort that needs to be automated.
Ensure that your recurring source files (like CSVs) are always saved in the same folder with the exact same file name, so Power Query can locate them automatically when refreshing.
Use Power Query to Transform Data and Create an Auto-Updating PivotTable
Import data using Power Query, record transformation steps like removing columns, and load the clean data directly into a PivotTable for easy refreshing.
Power Query allows you to set up a data connection that records your cleaning steps. Once configured, replacing the source file and clicking refresh will automatically reapply all formatting and update your PivotTable.
Go to the Data tab, click on From Text/CSV, and select your source data file to initiate the import.
Click Transform Data at the bottom of the preview window to open the Power Query Editor.
Select the columns you do not need, right-click the column header, and choose Remove. Repeat this for any other data cleaning steps.
Click the arrow below Close & Load on the Home tab, select Close & Load To..., choose PivotTable Report, and select where you want the PivotTable placed.
When your CSV file is updated with new data, simply save it with the same name, go to the Data tab in Excel, and click Refresh All. Both the query and the PivotTable will update instantly.

Automate Data Imports and PivotTables in WPS Spreadsheet
WPS Spreadsheet offers powerful built-in tools to easily import CSV data and create dynamic PivotTables. You can efficiently manage your data connections and refresh your reports in seconds whenever your source data updates.
- 1. Import Your Data: Open WPS Spreadsheet, navigate to the Data tab, click on Import Data, and select your CSV or text file.
- 2. Insert a PivotTable: Highlight your imported data range, go to the Insert tab, and click PivotTable to create your report structure.
- 3. Refresh the Data: When your source data is updated, simply right-click anywhere inside the PivotTable in WPS Spreadsheet and select Refresh Data to update your results immediately.

Frequently Asked Questions
Why doesn't my PivotTable update automatically when I open the Excel file?
By default, PivotTables do not refresh upon opening to save processing time. You can change this by right-clicking the PivotTable, selecting PivotTable Options, navigating to the Data tab, and checking 'Refresh data when opening the file'.
Can I use Power Query to import data from multiple Excel files at once?
Yes, you can navigate to Data > Get Data > From File > From Folder. This allows Power Query to automatically combine and apply your transformation steps to all files within a specific directory.
What happens if I rename the source CSV file or move it to another folder?
If the source file name or location changes, Power Query will display an error when refreshing. To fix this, open the Power Query Editor, click on the 'Source' step under Applied Steps, and update the file path to the new location.




