From the course: Excel: Power Query for Beginners

Getting data from another file

- [Instructor] More often than not, you'll get data in the form of a file, and you'd like to clean it up using Power Query. For example, I have this CSV file here called 01_01 SalesData.csv. Instead of just opening this file, how can I import it into another workbook? I'll show you how. First I'll bring up a brand new workbook. I'll go to File and then New, and then click Blank Workbook. And now I'm ready to import that CSV file into this file. So I'm going to do that by going to the Data tab, and then I'm going to use this button here From Text CSV. Now, in some other versions, you won't see this button. Instead, you go to a different location. You go to the Data tab, and then you click From File and then From CSV. But since I have this button here, I'm going to go ahead and click it. And I'm going to get the Import Data dialog box. And in the practice files, I'm going to open up 01_01 SalesData.csv and click Import. When you first import, you'll see this Preview dialogue, and this gives you an idea of the data inside the file, but we need to do a little bit of cleaning up, so we'll go ahead and go down here and click Transform Data. And what appears, this is the Power Query window. Specifically, it's called the Power Query Editor, but for all intents and purposes, this is Power Query. What you do here is you clean up data, you transform it. So let's do that. We'll clean some stuff up. Let's remove these blank rows, and we'll do that by going to Remove Rows, say Remove Blank Rows. When this Power Query Editor window is open, you can't do anything back in Excel until you close this window and load the data into Excel's rows and columns. So I'll do that by clicking Close and Load. And there we go. We've got the data imported, and those blank rows are removed. There are a couple of other things to notice. Notice that Excel made a new sheet tab here called 01_01 SalesData. It picked this up from the file name. And it's also important to notice the Queries and Connections pane over here on the right. Or if you have an older version of Excel, it's called Workbook Queries. And this pane shows us that there is a query called 01_01 SalesData that is providing the data here, and in fact, it's providing 210 rows of data. Now let's go over refreshing the data real quick. I'm going to switch on over to the CSV file again. And let's say we actually made a mistake, and Nancy's sales amount really should be 10,000, not 100. So I'll make that change. I will save it, and I will go back to the workbook we were just in. And you see, I've got the old sales amount here of 100, but let's say I want to refresh and get a more updated amount. I can go ahead and right-click the query and choose Refresh. And you see that 10,000 amount gets refreshed there. So importing is the first step on your journey to working with Power Query. Fairly simple and straightforward, but without importing, you can't do all of the other handy things that Power Query offers to make the data more useful to you.

Contents