From the course: Power BI Data Methods (2019)

Connecting to CSV or text files

From the course: Power BI Data Methods (2019)

Start my 1-month free trial

Connecting to CSV or text files

- [Instructor] We first look at how to connect to static files. Unlike Excel files, text files store unlimited rows of data, but do not store formatting or calculations. The commonly used CSV files use commas to separate the fields for each data record or row. DSV files use other separators such as tabs or colons. Fixed width text files use a fixed number of characters allocated to each field to separate the fields, rather than the actual separator. Let's see how we can import a CSV file into Power BI. We download the CSV file of weekly flu mortality numbers from the CDC website we see here. In the FluView, let's go ahead and download the data. We select the data source as ILINet. Click on national for the radio button, and then let's also select the past three seasons for the flu data. Go ahead and click download data. You'll also find a copy of the CSV in the exercise files. Now that you've downloaded the data, go ahead and open up Power BI. When we open up Power BI, we click on get data on the splash screen. We set up the text CSV connector to the file we just downloaded. Go ahead and click on this CSV file. And rather than loading, we just go ahead and hit transform data. Now we see here the data table from the CDC flu mortality numbers. And when you look over here to the applied steps on the right hand side, notice that we have a source step and a changed type step. The gear wheel indicates that we can edit this existing step, so we go ahead and double click on the source step. We see the path. We also see that it opens as a CSV document and uses a comma as a delimiter. Go ahead and click okay. Now we rename this query CSV CDC flu data. Now I'm going to go ahead and save this Power BI file. So I go to file, save as. So now in this message, go ahead and apply later. And save this file as CDC flu data. Great, we've just imported our first CSV.

Contents