Questions tagged [csv]

A comma-separated values file (CSV) stores tabular data in plain-text form.

A comma-separated values (CSV) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal comma or tab. Usually, all records have an identical sequence of fields.

130 questions
14
votes
1 answer

Is there a way, ideally using the command line, to convert multiple .csv files to one multi-sheet .xls spreadsheet?

Is there a way, ideally using the command line, to convert multiple .csv files to one multi-sheet .xls spreadsheet? If there isn't a cli solution, it'd be good to know if there's an API that works in, ideally, AWK or Pascal, but, failing that, in…
13
votes
5 answers

Add column from one .csv to another .csv file

file1.csv A,,C,D A,,C,D A,,C,D A,,C,D file2.csv A,B A,B A,B A,B desired Output.csv A,B,C,D A,B,C,D A,B,C,D A,B,C,D I've tried using "join" and "paste" to no avail. Is there a bash command to do this? Column "A" is the same in both .csv files.
Roboman1723
  • 2,975
  • 8
  • 26
  • 32
13
votes
1 answer

How to batch rename files (images) based on CSV file

What I have and want to achieve: There are thousands of images in one folder. I have a CSV file with following columns: A: original name B: renamed name A typical row looks like this: "original-1.jpg","renamed-1.jpg" …
take2
  • 347
12
votes
2 answers

How can I print sheetnames of a spreadsheet using Linux command-line?

I am aware of using in2csv to save a particular worksheet as a .csv: in2csv --sheet "sheet name" file1.xls > sheet-name.csv But are there any other tools to just print the sheetnames? Perhaps there are options with Perl?
csheth
  • 431
12
votes
1 answer

adding a new column as line number in a csv file

I created a csv file but forgot to add line number as the first column. What is the fastest way to do this (for a large…
Mona Jalal
  • 4,695
  • 21
  • 74
  • 102
10
votes
4 answers

Convert .xls/.xlsx spreadsheets to multiple .csv's based on a list

I need to convert all sheets of a single .xls/.xlsx file to a .csv. This will be done on all .xls files in all directories and sub-directories (recursively). Step 1: Get the sheetnames of all .xls into a .csv using: for file in $(find . -name…
csheth
  • 431
10
votes
5 answers

How can I convert a CSV file to XML?

How can I convert a CSV file to XML? Is there any software for Ubuntu?
Vitor Mazuco
  • 1,461
10
votes
1 answer

Convert a .txt file in a .csv with a row every 3 lines

Let's say I have a txt file like this: Mario mario@me.com +399038259953 Luigi luigi@live.com +395902385093 Yoshi yoshi@yahoo.com +81293565291 [and so on for 300 lines...] How do I make a .ods (or .xls, or .csv, it does not matter) file which has…
9
votes
3 answers

How to split an ODS spreadsheet file into csv files per sheet on the terminal?

I would like to split a spreadsheet (ods or xlsx) into multiple csv files, one for each sheet in the spreadsheet. I would like to do this without launching a graphical app and preferably in a one liner. Any ideas? Though the linked duplicate…
Bruni
  • 11,099
8
votes
6 answers

Import users from CSV file

Is it possible to import users by using CSV file? or something like a LDAP connection to import all users?
Driekus
  • 113
8
votes
4 answers

From XML to CSV with command line

if I have a XML file on local disk, which command is need to convert file in CSV? And from XLSX or XLS to CVS? Thanks.
7
votes
6 answers

How to transform valid JSON to CSV?

I'm trying to extract information from a JSON file and write some of the contents to a CSV file. Here is an example of my text "data":{"headers":{"sender":"frank@abc.com" "to":"jim@def.com" "subject":"Help with this…
BeMy Friend
  • 1,173
6
votes
4 answers

How to add users from .csv by specific field?

I'm trying to sort my users into specific servers, so what I'm trying to do at the moment is grab all the users by gender. Essentially I would have one server with all male users and one with all female users. The data in the file per line is read…
Danny
  • 95
6
votes
2 answers

Libre Office Calc: Export to CSV with CRLF line endings

I need to be able to save files created in LibreOffice Calc to CSV with the CRLF line endings. I have tried many options but the files always come out missing the CR part. I work with programs that will not import the CSV files without the windows…
Adam
  • 341
6
votes
4 answers

Comparing two text files

I have 2 big csv files, file1.csv which looks like this 1,2,3,4 1,4,5,6 1,7,8,9 1,11,13,17 file2.csv which looks like this 1,2,3,4 1,7,8,9 2,4,9,10 13,14,17,18 These are just random numbers that I made up, basically the two numbers where…
Lynob
  • 6,775
1
2 3
8 9