 Hello and welcome. Today we're going to be looking at taking spreadsheets at different formats and converting them to a plain text CSV file, which is a comma separated file, comma separated value file that we can then easily manipulate with scripts. So in my directory here, I have two spreadsheets, one in an open document spreadsheet format and the other one in a Microsoft Excel format. And we're going to be using LibreOffice. So if I wanted to view these, I can say LibreOffice and I can give it one or both of those files. I'll just give it the Microsoft spreadsheet. And there you go. It's an example file that I've created for you guys that has basically, it's a list of people and addresses, phone numbers and that sort of stuff just for testing out scripts. I'll have a link to this in the description of the video as a CSV file. So here it is. And let's say we want to convert that to a CSV file. Again, it's going to be a plain text file where each of the cells is separated by a comma or whatever character you want. And the way you would do that in LibreOffice is go to file and save as. And then you would choose what file format you want, in this case text CSV. And we will click save and it will say are you sure because you're going to lose formatting. So if you had fonts and colors and other advanced things in the spreadsheet, you're going to lose those. You're just going to get the text, which is what we want. So we're going to use the text CSV format. Now it's going to ask you, what do you want as a delimiter? Again, the default is a comma. You can use any character you want. There's some suggestions here. You can use tabs, spaces. I tend to use a pipe character because that's very uncommon in the text. But the most common is going to be a comma. And then the string delimiter is going to be, let's say you have a comma in one of your strings. It will put your strings in quotation marks so you know the difference between a comma that's separating a field and a comma in your text. Anyway, I'll click OK. And now that's saved, I can close this out. And I now have a file called people.csv. And I can cap that out, people.csv. And there's the list names. And then if I want, I can say grep. And I can grep something like Jones from the list. You can find everyone with the name Jones. If I want, then I can grep from that. And I'll say Alice. And I'll have Alice. And then I can do something like cut dash d for delimiter. It's going to be a comma in this case. And if I want, I can go dash f for field four here. And then we go, I got her street address. If I want, I can do dash f four comma five comma six. And I'll get her address along with her city and zip. Another thing you could do if you want to be a little more advanced about it, instead of using grep, if you have FZF fuzzy finder on your system, I can say cat people.csv and pipe that into FZF. And now, when I hit Enter, it gives me the full list names. And I can type something like Johnson. And I want April Johnson. And now I hit Enter, and it does the same thing. But it allows me to do that quick fuzzy finding search. Now you're going, Chris, that's great that you showed us that. But I thought the title of the video says how to do it in the shell. Well, you're in luck. Let me go ahead and remove our people.csv file. And we just did that with LibreOffice by saving it as a CSV file. But as you can see now, I have those two file formats in here. You can actually use LibreOffice in headless mode. So I can say LibreOffice dash dash headless. And then I can say dash dash convert dash two. And I can give it the format I want to convert to, in this case CSV, and the name of one of our files here. So I'll give it the open spreadsheet file this time. I'll hit Enter. And now it just created our CSV file for that. So again, now we can do the same thing we were doing before, list it all out, or go back to what we typed out earlier with FuzzyFinder here. And again, I can do like Smith. I want Mary Smith. There we go. And there I have her address. So again, it's LibreOffice dash dash headless for headless mode. And then dash dash convert dash two, the format you want to convert to, which are there other formats, but we're working with CSV files here and the name of the file you want to convert. Now, it's kind of a long command. So of course you can alias it if you wanted. You could do something like this. You can say alias, I'll say two CSV equals that. Now, you put that inside your RC file for your shell, and you should be able to type in two CSV and give it a file for. So let me remove the file that we've generated. And now I can say two CSV and I can give it the Excel file. And now I can cat out that people, that CSV file. So now you've taken the big long command that looks like this and changed it to this. So that's what aliases are for. I hope you found this useful. We're going to look at more file conversions in the next upcoming videos. And I hope you enjoyed this. If you did, be sure to like, subscribe, comment, all that good stuff. Check out filmsbychrist.com. That's Chris the K. There should be a link in the description. You can search through my videos there. And also think about becoming a Patreon over at Patreon or a patron over at patreon.com for slash mail x1000. There's a link to that in the description. And as always, I thank you for watching and I hope that you have a great day.