How to Automatically Import CSV Data into an Excel Trading Worksheet
Question details
The user needs to automate the import of daily options-trading CSV files into an Excel worksheet, populate calculated fields, and maintain conditional formatting without creating a new tab for each trading day.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Automating the daily import and formatting of trading data from CSV files for financial tracking and analysis.
- Observed behavior
- The current approach risks manually creating separate worksheets for each trading day, which fragments data and complicates long-term tracking and formula maintenance.
Create a dedicated folder on your computer to store all your daily trading CSV files, ensuring they follow a consistent naming convention and column structure.
Use Power Query to Consolidate Daily CSV Files
Power Query automates the extraction and transformation of CSV files from a folder into a single master table, eliminating the need for daily manual imports.
Instead of maintaining a cumbersome Monday-to-Friday worksheet setup, the most efficient approach is to consolidate all trading data into one master table. By leveraging Power Query, you can automatically append new daily files to this table.
Using a single table with a 'Trading Date' column unlocks the full potential of PivotTables and charting tools, making long-term trend analysis seamless.
Open Excel, navigate to the Data tab on the ribbon, and click Get Data > From File > From Folder. Browse to the specific folder where you save your daily trading CSVs and click Open.
In the preview window that appears, click Combine > Combine & Transform Data. This will open the Power Query Editor, merging all files in the folder.
If your CSVs do not already contain a date column, use the 'Source.Name' column (which usually contains the filename) to extract the date, or manually go to Add Column > Custom Column to generate a 'Trading Date' field.
Create your calculated fields directly in Power Query by adding Custom Columns with your required mathematical formulas, ensuring they automatically apply to all future imports.
Click Close & Load To... on the Home tab of the Power Query Editor. Select 'Table' and load it into your existing worksheet. You can now apply conditional formatting to this table, which will expand dynamically as new data is refreshed.

Streamline Your CSV Trading Data Imports with WPS Office
WPS Spreadsheet provides robust data import and analysis tools perfectly suited for handling daily trading CSVs. You can consolidate datasets, build dynamic PivotTables, and maintain conditional formats with ease.
- 1. Import Your CSV Data: Open WPS Spreadsheet, go to the Data tab, click on Import Data, and select your trading CSV file.
- 2. Format and Clean Columns: Use the Text Import Wizard to properly delimit your data by commas. Ensure a 'Trading Date' column is included in your dataset.
- 3. Format as Table: Select your imported data, go to the Home tab, and click Format as Table. This ensures your formulas and conditional formatting carry over to new rows.
- 4. Analyze with PivotTables: Navigate to the Insert tab, click PivotTable, and use your consolidated data to build interactive trading summaries.

Frequently Asked Questions
Why shouldn't I create a separate worksheet for every trading day?
Storing each day's data on a different tab fragments your data, making it nearly impossible to build comprehensive charts, track historical trends, or use PivotTables effectively. A single master table with a 'Trading Date' column is the industry standard for data analysis.
Will my conditional formatting disappear when I import new CSV data?
If you load your CSV data into an official Excel Table (using Ctrl+T or formatting as a Table), your conditional formatting rules and calculated formulas will automatically expand to encompass new rows as data is appended or refreshed.
Can I automate calculations during the CSV import process?
Yes. By using Power Query to handle your imports, you can build calculated columns directly within the Query Editor. These calculations act as automated rules that process the raw CSV data before it ever loads into your final worksheet.
What happens if a newly downloaded CSV file has missing columns?
Power Query is generally resilient, but if strict column headers change or disappear, the query may return an error upon refresh. It is crucial to ensure your trading platform exports the CSV in a consistent format every day.




