From the course: Complete Guide to Generative AI for Data Analysis and Data Science

Using spreadsheets with CSV files

- [Instructor] One of the nice things about working with CSV files is that it is really trivial to work with CSV files in spreadsheets. And I just want to show you, if you haven't done this before, if you haven't worked with CSV files before, how simple it is. I'm going to first show you an example in Google Sheets and then in Microsoft Excel. Now in my case, I've just opened a browser window to open a Sheets spreadsheet, and what I want to do is I want to import into Sheets a particular file. Now I can, because this is online, I could pull it from my drive, but I'm going to upload from a local file. So I'm just going to browse and choose this file products.csv. So you'll notice I have a file called products.json, but that's not simple, it's not trivial to upload A JSON file into a spreadsheet. So we'll talk about how you can convert JSON or extract items from JSON and put them into CSV so that you could use those data elements in a spreadsheet. But here we're just going to select our example products that CSV file and say open. And now in Google's case, it's prompting me, it wants to know, do I want to create a new sheet, insert a new sheet, replace, apphend. I'm just going to go ahead and create a new spreadsheet, and I'm going to let it detect automatically what the separator is like, whether it's a comma or a tab, or some custom other character. So I'm going to allow it to detect automatically and I'm going to import the data and open now. So here we have a new spreadsheet and we can see we have names here and we have product name, product category, and price per unit. So really simple, we didn't have to do anything. This was almost as easy as opening up just a spreadsheet file. So let's see how we do something equivalent in Microsoft Excel. I'm just going to open that up. So I have Microsoft Excel open here. Now here I can simply open as an option and go to CSV. So what we see here is I didn't have to answer any questions about the way I had to with Google Sheets, but it basically treated the CSV file as if it were almost like a Microsoft Excel format that it knows so well because again, it's fairly trivial to work with CSV. So with Excel, you can open CSV files just as you would open a Microsoft Excel formatted file. So again, I just want to show this to you in case you haven't worked with CSV files and spreadsheets before, but it could not be more simple to open a CSV file and get working with it in a spreadsheet.

Contents