Skip to main content

๐Ÿ“Š Lesson 6.2: Import/Export & a Taste of Power Query

Real-world data rarely starts life inside your workbook โ€” it arrives as a download, an export from another app, or a file someone hands you. This lesson is about the doors of Excel: getting data cleanly in and back out. You'll master the humble but treacherous CSV file, learn to export to CSV and PDF, and get your first taste of Power Query โ€” the tool that turns tedious, repeat-it-every-week cleanup into a recorded set of steps you refresh with one click.

๐Ÿ“š What You'll Learn

By the end of this lesson, you will be able to:

  • Import a CSV or text file into Excel and open other common formats
  • Export your work to CSV and PDF, and know which to use when
  • Recognize and avoid the classic CSV pitfalls โ€” data types, dates, and encoding
  • Explain conceptually what Power Query (Get & Transform Data) does and why refreshable steps beat manual cleanup
  • Understand the honest scope: full Power Query is richest on Windows desktop; web and Mac are lighter

โฑ๏ธ Estimated Time: 45 minutes

๐ŸŽฏ Project: Import a small CSV file and perform one or two cleanup steps โ€” using Power Query if you're on Windows desktop, or a manual import on the web.

In This Lesson

Data In, Data Out โ€” the Big Picture

Think back to our course through-line: Data โ†’ Formulas โ†’ Analysis โ†’ Visualization โ†’ Dashboard. Everything downstream depends on that very first word, Data โ€” and most useful data doesn't originate in your workbook. Your bank exports transactions as a CSV. Your online store downloads sales as a text file. A colleague sends you a report from a different system entirely. Being able to bring that data in cleanly, and to push finished work back out in a format others can use, is an everyday professional skill.

There are two directions to master. Importing is pulling outside data into Excel so you can work with it. Exporting is saving your Excel data in a different format so another person or program can use it. Between them sits a crucial idea we'll build toward: importing well isn't just "open the file" โ€” it's often "open the file and clean it up," and Power Query exists to make that cleanup repeatable so you never have to do it by hand twice.

graph LR A["๐ŸŒ Outside sources
CSV ยท text ยท other apps"] --> B["๐Ÿ“ฅ Import
into Excel"] B --> C["๐Ÿงน Clean & shape
manual or Power Query"] C --> D["๐Ÿงฎ Your workbook
formulas, tables, charts"] D --> E["๐Ÿ“ค Export
CSV or PDF"] E --> F["๐Ÿ‘ฅ Share with people
or other programs"]

Importing CSV, Text & Other Formats

The single most common data format you'll meet is the CSV โ€” "comma-separated values." It's a plain-text file where each line is a row and commas separate the columns, like this:

Date,Category,Description,Amount
2026-01-03,Groceries,Supermarket,54.20
2026-01-05,Transport,Bus pass,30.00
2026-01-06,Groceries,Farmers market,18.75

CSV is beloved because almost every program on earth can produce and read it โ€” it's the universal handshake between systems. It's also stripped-down: it carries only raw text and numbers, with no formulas, no formatting, no colors, no multiple sheets. That simplicity is both its strength and, as we'll see, the source of its pitfalls.

Ways to bring data in

  • Just open it. The quickest route: File > Open and pick the CSV. Excel parses the commas into columns and drops the data onto a sheet. Fast, but it's a one-time snapshot with no cleanup steps remembered.
  • Get & Transform (Power Query). On the Data tab, use Get Data / From Text/CSV. This opens a preview where you confirm the delimiter and data types before loading, and โ€” crucially โ€” it records the import as refreshable steps. This is the grown-up way, covered in detail below.
  • Paste. For a quick one-off you can copy text and paste it in, then use Text to Columns (Data tab) to split a single column on commas.

Other formats Excel opens

Beyond CSV, Excel opens plain text files (.txt, often tab-delimited), other Excel formats, and โ€” through Get Data on the desktop โ€” a wide world of sources like databases, the web, and more. For this introductory lesson we'll focus on the everyday case: a CSV or text file you've downloaded.

๐Ÿ“– Definition

Delimiter: the character that separates one column from the next. In a CSV it's a comma, but you'll also meet tab-delimited files (columns split by tabs, common in .txt exports) and, in some regions, semicolon-delimited files โ€” because countries that use a comma as the decimal mark (so "1.234,56" means one-thousand-two-hundred) switch the column separator to a semicolon to avoid a clash. When an import lands everything in one column, a wrong delimiter is usually why.

The Pitfalls of CSV โ€” Types, Dates, Encoding

Here's the honest truth about CSVs: because they carry only raw text with no type information, Excel has to guess what each value is meant to be โ€” and sometimes it guesses wrong, silently. Knowing the three classic traps turns "why does my data look weird?" into a problem you can fix in seconds.

1. Data types โ€” numbers that should be text

Excel eagerly interprets values. A ZIP code like 02139 gets read as the number 2139 โ€” the leading zero vanishes. A long product code or credit-card-like number may be shown in scientific notation (1.23E+15) or have its final digits rounded off, because Excel treated it as a number when it was really an identifier. The fix is to tell Excel a column is text, not a number โ€” which the Get & Transform preview (or Text Import) lets you do per column before the data lands.

2. Dates โ€” the ambiguity trap

Dates are the most notorious. Is 03/04/2026 the 3rd of April or the 4th of March? It depends on the file's origin and your computer's regional settings, and Excel will pick one interpretation โ€” sometimes the wrong one โ€” without asking. Values it doesn't recognize as dates may stay as plain text, so they won't sort or calculate. The defenses: prefer sources that use the unambiguous ISO format (2026-04-03, year-month-day), and set the date column's type and locale explicitly on import rather than trusting the guess.

3. Encoding โ€” the garbled-characters trap

A CSV is text, and text has an encoding โ€” the scheme that maps bytes to characters. If a file was saved as UTF-8 (the modern standard, which handles every language and emoji) but Excel opens it assuming an older encoding, accented letters and symbols turn to gibberish โ€” cafรฉ becomes cafรƒยฉ, curly quotes become junk. The fix is to choose the correct File Origin / encoding in the import dialog; UTF-8 is the right answer the vast majority of the time today.

Symptom Cause Fix
Leading zeros gone (02139 โ†’ 2139) Excel read an ID as a number Set that column's type to Text on import
Big code shows as 1.23E+15 Number too long, shown in scientific notation Import the column as Text
Dates wrong or stuck as text Day/month ambiguity or unrecognized format Set date type + locale; prefer ISO YYYY-MM-DD sources
Accents garbled (cafรฉ โ†’ cafรƒยฉ) Wrong text encoding Choose UTF-8 as the file origin/encoding
Everything in one column Wrong delimiter (comma vs semicolon vs tab) Pick the correct delimiter in the import preview
โš ๏ธ Important Note: The safest habit with any downloaded CSV is to preview before you trust. The Get & Transform / Text Import path shows you the parsed data and lets you set each column's type and the file's encoding before it lands โ€” which is exactly why it beats a blind double-click for anything that matters.

Exporting โ€” CSV vs PDF

Getting data out is the mirror image, and the format you choose depends entirely on who or what will receive it. Use File > Save As (or Export) and pick the format.

Export toโ€ฆ Best for What you lose
CSV (.csv) Feeding raw data into another program or system Everything but values โ€” no formulas, formatting, charts, or extra sheets (only the active sheet is saved)
PDF (.pdf) Sending a fixed, print-ready view for people to read It's a picture of the data โ€” not editable, no live formulas
Excel (.xlsx) Sharing with another Excel user who needs the real thing Nothing โ€” it's the full, native workbook

The mental rule is simple. Exporting to CSV says "here's the raw data for a machine" โ€” it's lossy on purpose, keeping only values so another system can ingest them. Watch out: saving to CSV keeps only the active sheet and drops all formulas, formatting, and charts, so keep your real .xlsx as the master and treat the CSV as a disposable export. Exporting to PDF says "here's a fixed snapshot for a human to read or print" โ€” it looks exactly as designed and can't be accidentally edited, but it's frozen. When the recipient is another Excel user who needs to keep working, don't convert at all โ€” just share the .xlsx (or, better, a OneDrive link as you learned last lesson).

๐Ÿ’ก PDF tip: set the print area first

Before exporting to PDF, glance at the page layout โ€” set a Print Area, choose portrait vs landscape, and consider Fit Sheet on One Page so your table doesn't get sliced across pages. A little layout care makes a PDF that looks intentional rather than chopped up.

A Taste of Power Query

Now the star of this lesson. Imagine you download a messy sales CSV every Monday: it has junk columns you don't need, names split awkwardly, dates as text, and a few blank rows. Cleaning it by hand takes fifteen minutes โ€” and you do it every single week, forever. That's the problem Power Query was built to kill.

Power Query โ€” labeled Get & Transform Data on the Data tab โ€” lets you connect to a data source and apply cleanup steps that are recorded. Each thing you do (remove a column, split a column, filter out blanks, change a type) is saved as a step in a list. When next week's file arrives with the same shape, you don't redo anything โ€” you click Refresh, and Power Query re-runs every recorded step on the new data automatically. Fifteen minutes becomes one click.

The kinds of transforms you'll use

Inside the Power Query Editor โ€” a separate window that opens over a preview of your data โ€” you shape the data with buttons, no coding required. The common moves:

  • Remove columns you don't need, so only relevant data loads.
  • Split a column โ€” e.g. turn "Smith, Jane" into separate Last and First columns by the comma.
  • Filter rows โ€” drop blank rows, remove a category, keep only this year.
  • Change type โ€” mark a column as Date, Whole Number, or Text (this is where you fix the CSV type pitfalls, permanently).
  • Unpivot โ€” the powerful one: turn a wide, human-friendly table (a column per month) into a tall, analysis-friendly one (a Month column and a Value column), which is exactly the shape PivotTables love.

Every step appears in an Applied Steps list on the right. You can rename a step, delete one, or reorder them โ€” it's an editable recipe. When you're happy, you Close & Load, and the cleaned result drops into your workbook as a proper Excel Table, ready for formulas and PivotTables.

graph LR A["๐Ÿ“ฅ Connect to source
CSV, text, more"] --> B["๐Ÿงน Apply steps
remove, split, filter, change type"] B --> C["๐Ÿ“‹ Applied Steps
an editable recipe"] C --> D["โฌ‡๏ธ Close & Load
to a Table"] D --> E["๐Ÿ”„ Next file? Just Refresh
steps re-run automatically"] E --> B

Why it beats manual cleanup

The magic word is repeatable. Manual cleanup โ€” deleting columns, running Text to Columns, retyping dates โ€” works once, then vanishes; next week you start from scratch, and every manual pass risks a new mistake. Power Query's steps are saved with the workbook, so the cleanup is done once and refreshed forever. It's also self-documenting (the Applied Steps list is the documentation of exactly what you did), and it's non-destructive โ€” your original source file is never changed, only read. For any data you'll process more than once, this is transformational.

๐Ÿ’ก Compared to Google Sheets

If you know Sheets, there's no direct Power Query equivalent โ€” you'd reach for functions like QUERY, IMPORTRANGE, or Apps Script for similar jobs, which are powerful but more manual or code-driven. Power Query's recorded, button-driven, refreshable steps are one of Excel's genuine standout strengths for repeatable data cleanup.

Honest Scope & Best Practices

โš ๏ธ Honest scope: where Power Query is fullest

Be clear-eyed about platform differences, because Power Query is one of the biggest ones in Excel. The full, richest Power Query lives in the Excel desktop app on Windows โ€” the complete Editor, the widest set of data connectors, and every transform. The Mac desktop app has Power Query but has historically been more limited, and Excel for the web offers a lighter Get & Transform experience that has grown over time but isn't the full desktop tool. Microsoft keeps expanding what's available on each platform, so check Microsoft's current support pages for what your version supports rather than trusting a fixed list. This lesson is a conceptual taste, not a deep Power Query tutorial โ€” the goal is that you recognize what it is and reach for it when cleanup gets repetitive.

โœ… Do's

  • Preview CSVs before trusting them โ€” use Get & Transform / Text Import to set types and encoding up front.
  • Prefer ISO dates (YYYY-MM-DD) and UTF-8 whenever you control the source file.
  • Keep your .xlsx as the master; treat exported CSVs as disposable copies for other systems.
  • Reach for Power Query the moment cleanup repeats โ€” if you'll do it twice, record it once.

โŒ Don'ts

  • Don't blindly double-click a CSV for important data โ€” leading zeros and dates can silently break.
  • Don't save your working file as CSV as its home format; you'll lose formulas, formatting, charts, and every sheet but one.
  • Don't assume the web has full Power Query โ€” flag desktop-only steps when you share a workflow with others.
  • Don't hand-clean the same file every week โ€” that's precisely the job Power Query erases.

๐Ÿ’ก Pro Tips

  • Rename your Power Query steps ("Removed junk columns," "Set date type") โ€” future-you will thank present-you.
  • If an import lands everything in one column, the delimiter is wrong โ€” switch comma/semicolon/tab in the preview.
  • Loading a Power Query result to a Table means your later formulas and PivotTables refresh right along with it.

๐ŸŽฏ Project: Import & Clean a CSV

You'll create a tiny CSV, import it into Excel, and perform one or two cleanup steps. If you're on Windows desktop, do it with Power Query so you feel the recorded-steps magic. If you're on the web or Mac, a manual import with type-setting is perfectly fine โ€” the concepts are identical.

๐Ÿ‹๏ธ From messy CSV to a clean Table

Objective: Import a small CSV, fix at least one data-type or column issue, and load the result cleanly into your workbook.

Instructions (about 15 minutes):

  1. (3 min) Make a CSV. In any plain-text editor (Notepad, TextEdit in plain mode), paste the starter data from the hint below and save it as expenses.csv.
  2. (3 min) Import it. Desktop: Data > Get Data > From Text/CSV, pick the file, and check the preview. Web/Mac: use Data > From Text/CSV if present, or File > Open the CSV.
  3. (4 min) Do at least one cleanup step: set the ZipCode column type to Text (so 02139 keeps its leading zero) or set the Date column to a proper Date type. In Power Query these appear in Applied Steps.
  4. (3 min) If using Power Query, also remove one column you don't need, then Close & Load to drop the result in as a Table. On the web, just confirm the types look right after importing.
  5. (2 min) Look at the result: is the leading zero preserved? Are dates real dates (right-aligned, sortable)? Note what would happen next week if you refreshed with a new file.
๐Ÿ’ก Hint โ€” starter CSV data
Date,Category,ZipCode,Amount
2026-01-03,Groceries,02139,54.20
2026-01-05,Transport,02139,30.00
2026-01-06,Groceries,90210,18.75
2026-01-09,Utilities,02139,88.40

Notice 02139 โ€” the whole point. If Excel imports ZipCode as a number, the leading zero disappears. Setting the column to Text keeps it intact. If you're in Power Query, watch the Applied Steps panel record each change; that list is your reusable recipe.

โœ… Project Completion Checklist

  • You created and saved a small expenses.csv file
  • You imported it into Excel (Power Query on desktop, or manual on web/Mac)
  • You fixed at least one type issue (ZipCode as Text and/or a real Date column)
  • The 02139 ZIP kept its leading zero in the result
  • You can explain what "Refresh" would do if next week's file arrived

๐ŸŽฏ Quick Quiz

Question 1: You import a CSV and a ZIP code 02139 shows up as 2139. What happened, and how do you fix it?

Question 2: What is the main advantage of cleaning data with Power Query instead of by hand?

๐Ÿ““ Learning Journal

Keep a learning journal as you work through this course โ€” a separate document, a note, or even a second worksheet right in the workbook you're building. After each lesson, take a few minutes to write down:

  • Key concepts you learned
  • Techniques that clicked for you
  • Questions or confusion points to revisit
  • Ideas you want to try with your own data
  • Your progress and feelings about learning this โ€” including where your confidence grew

โœ๏ธ This lesson's prompt: What data in your life arrives as a file you have to clean up repeatedly โ€” bank exports, a downloaded report, sales data? Describe the cleanup you do by hand today, and how a recorded, refreshable Power Query recipe would change that weekly chore. If you're on the web, note which steps you'd want the desktop app for.

๐Ÿ“ Lesson Summary

๐ŸŽ“ Key Takeaways

  • CSV is the universal data format โ€” plain text, comma-separated โ€” readable everywhere, but it carries only values (no formulas, formatting, or extra sheets).
  • The classic CSV pitfalls are data types (lost leading zeros, scientific notation), dates (day/month ambiguity), and encoding (garbled accents) โ€” preview and set types/encoding on import to avoid them.
  • Export to CSV for raw data into other systems (lossy), to PDF for a fixed, print-ready human view, and keep .xlsx as your master.
  • Power Query (Get & Transform Data) records cleanup as steps โ€” remove columns, split, filter, change type, unpivot โ€” that load to a Table and refresh on new data with one click.
  • Its superpower is being repeatable: clean once, refresh forever. Honest scope โ€” full Power Query is richest on Windows desktop; web and Mac are lighter.

๐ŸŽ‰ What You've Accomplished

You can now move data through Excel's doors with confidence: importing CSVs and text without falling into the type/date/encoding traps, exporting to the right format for the audience, and โ€” most importantly โ€” you understand what Power Query is for. You've met the idea that cleanup can be recorded once and refreshed forever, which is one of the most time-saving habits in all of spreadsheeting.

โ“ Common Questions

Should I save my working file as CSV to keep it small?

No โ€” keep your working file as .xlsx. Saving as CSV throws away all formulas, formatting, charts, and every sheet except the active one; you'd be discarding your actual work. Export a CSV only when another program needs the raw values, and treat that CSV as a disposable copy.

My dates imported wrong โ€” half became text and the rest flipped day and month. Why?

CSV carries no type information, so Excel guesses based on the values and your regional settings, which causes both problems. The reliable fix is to set the date column's type and locale explicitly on import (via Get & Transform), and, whenever you can control the source, use the unambiguous ISO format YYYY-MM-DD.

I only have Excel for the web. Can I still use Power Query?

Partly. The web has a lighter Get & Transform experience that keeps growing, but the full Power Query โ€” the complete Editor, all connectors, every transform โ€” lives in the Windows desktop app. You can do plenty on the web and still complete this lesson's project with a manual import; reach for the desktop app when you need the deepest cleanup power. Check Microsoft's current pages for what your version includes.

๐Ÿ”ญ Looking Ahead

In the next lesson โ€” Lesson 6.3: A Taste of Macros/VBA & Office Scripts (Honest Scope) โ€” we take repeatability one step further: automation. You'll meet the macro recorder and VBA (Windows desktop), the modern cloud-based Office Scripts (web), and get an honest sense of when automating a task is genuinely worth it.

โœ… Before the Next Lesson

  • Successfully import your expenses.csv with at least one type fixed
  • Try exporting one sheet to PDF and notice the layout options
  • Write your Learning Journal entry for this lesson

๐Ÿ“š Additional Resources

๐ŸŒŸ Encouragement for the Journey

You've learned to bring the messy real world into Excel cleanly โ€” and to send your work back out in the right shape for whoever needs it. Best of all, you now know that repetitive cleanup has a cure. That mindset โ€” "if I'll do it twice, record it once" โ€” carries straight into the next lesson on automation. ๐Ÿ“Š