tsv

Convert .XLS to tab separated .TXT

末鹿安然 提交于 2019-12-06 07:26:44
问题 Can I somehow convert Excel .XLS file to txt-tsv (tab-separated-values) file, using C#? 回答1: You may read that XLS file easily via OleDb (ADO.NET provider) and create a StreamWriter object to write data into the Text/TSV file. using (OleDbConnection cn = new OleDbConnection()) { using (OleDbCommand cmd = new OleDbCommand()) { cn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @"C:\path\file.xls" + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";"; cmd.Connection = cn;

convert a tsv file to xls/xlsx using python

非 Y 不嫁゛ 提交于 2019-12-06 04:39:25
问题 I want to convert a file in tsv format to xls/xlsx.. I tried using os.rename("sample.tsv","sample.xlsx") But the file getting converted is corrupted. Is there any other method of doing it? 回答1: Here is a simple example of converting TSV to XLSX using XlsxWriter and the core csv module: import csv from xlsxwriter.workbook import Workbook # Add some command-line logic to read the file names. tsv_file = 'sample.tsv' xlsx_file = 'sample.xlsx' # Create an XlsxWriter workbook object and add a

how to get data with tsv or csv to array in d3.js from a txt file?

谁都会走 提交于 2019-12-05 21:21:42
I am using this to parse a csv file and create an array data as specified in d3 docs: d3.tsv("classes_h.txt", function(data) { data.forEach(function(d) { console.log(data[0]); console.log("lol"); }); console.log(data[0]); }); or d3.tsv("classes_h.txt", function(data) { console.log(data[0]); }); However I get undefined in the console when I call the data[0]. I've also tried writing out "data instead of "data[0]" which result in me getting an empty array -> []: My txt file looks like this: http://puu.sh/7LrRm.png Everything is seperated with a tab, so tsv is what I'm using and if I have

How to export proper TSV?

孤人 提交于 2019-12-05 14:25:35
问题 Short and sweet: how can I export TSV/CSV from R? write.table / write.csv almost works: test <- data.frame(a = 2 : 4, b = 3 : 5) write.table(test, file='test.tsv', quote=FALSE, sep='\t') $ more test.tsv a b 1 2 3 2 3 4 3 4 5 … but produces a format that is different from what’s expected by most other programs: a b 1 2 3 2 3 4 3 4 5 – note the different handling of the header row. How can I export the second rather than the first format? Manually specifying the col.names as c('', colnames(test

convert a tsv file to xls/xlsx using python

余生长醉 提交于 2019-12-05 10:25:00
I want to convert a file in tsv format to xls/xlsx.. I tried using os.rename("sample.tsv","sample.xlsx") But the file getting converted is corrupted. Is there any other method of doing it? Here is a simple example of converting TSV to XLSX using XlsxWriter and the core csv module: import csv from xlsxwriter.workbook import Workbook # Add some command-line logic to read the file names. tsv_file = 'sample.tsv' xlsx_file = 'sample.xlsx' # Create an XlsxWriter workbook object and add a worksheet. workbook = Workbook(xlsx_file) worksheet = workbook.add_worksheet() # Create a TSV file reader. tsv

sqlite3 import with quotes

泄露秘密 提交于 2019-12-05 04:40:23
I am trying to import a collection of data that has quotes within the fields. They are currently tab separated. From what I can understand according to the docs ( http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles ), the sqlite shell should interpret quotes literally and I assume that means I shouldn't have a problem. I've been running into a problem on this line: 1193782372 Lips Like Sugar (12" Mix) Echo & the Bunnymen 80's/12": The Extended Collection a76d9b04-51d9-4672-801f-356ab36dbae7 ccd4879c-5e88-4385-b131-bf65296bf245 1abb270a-e791-407f-a989-ff3ad6f8401c Since it isn't clear where the

Combining certain columns of several tab-delimited files based on first column

*爱你&永不变心* 提交于 2019-12-04 14:43:45
1st column in inFile contains a string not necessarily present in all inFiles 2nd and 7th columns in each inFile contains the Title# strings Using AWK, I cannot piece this together correctly. My use of descriptive variables will hopefully help clarify what I'm trying to do. These are components I think I need: tab-separated input files: -F'\t' increment the strings in the 1st column, but only add each 'name' once to the '1stColumnNames': !1stColumnNames[$1]++ { name[++i] = $1 } make a new index for each .tsv file to store values for each file to avoid overwriting each column's values: !r

Convert .XLS to tab separated .TXT

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 12:40:21
Can I somehow convert Excel .XLS file to txt-tsv (tab-separated-values) file, using C#? You may read that XLS file easily via OleDb (ADO.NET provider) and create a StreamWriter object to write data into the Text/TSV file. using (OleDbConnection cn = new OleDbConnection()) { using (OleDbCommand cmd = new OleDbCommand()) { cn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @"C:\path\file.xls" + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";"; cmd.Connection = cn; cmd.CommandText = "select * from [Sheet1$]"; using (OleDbDataAdapter adp = new OleDbDataAdapter(cmd)) {

Extract data from tsv file python

心已入冬 提交于 2019-12-04 06:29:00
问题 I have a TSV file, that looks like this: A B C D D=1;E=2 S D F G H=2;B=4 I'd like to write the contents to another tsv file in this way. A B C D D 1 A B C D E 2 S D F G H 2 S D F G B 4 I'd really appreciate if anyone could help/ hint me in splitting column 5 as desired. 回答1: If you are positively sure you only have tabs and semicolons, then you can use split. with open('/tmp/test.tsv') as infile, open('/tmp/test2.tsv', 'w') as outfile: for line in infile: tsplit = line.split("\t")

How to export proper TSV?

不想你离开。 提交于 2019-12-03 23:19:04
Short and sweet: how can I export TSV/CSV from R? write.table / write.csv almost works: test <- data.frame(a = 2 : 4, b = 3 : 5) write.table(test, file='test.tsv', quote=FALSE, sep='\t') $ more test.tsv a b 1 2 3 2 3 4 3 4 5 … but produces a format that is different from what’s expected by most other programs: a b 1 2 3 2 3 4 3 4 5 – note the different handling of the header row. How can I export the second rather than the first format? Manually specifying the col.names as c('', colnames(test)) doesn’t work – R complains about an invalid argument. You can use col.names = NA : write.table(test,