csv

OleDb - big problems reading CSV file

Hello. I have to parse csv (txt extension) file. It is delimited with ',' and has all values in "". First problem. If file has name like this firstpart.secondpart.txt executing the reader throws exception saying that Microsoft Jet engine couldn't find table (or sth like that - I have polish WinXp). When I remove "secondpart" from file ...

Need to export fields containing linebreaks as a CSV from SQL Server

I'm running a query from SQL Server Management Studio 2005 that has an HTML file stored as a a string, e.g.: SELECT html FROM table This query displays in the "Results" window nicely, i.e., each row contains a string of the whole HTML file, with one record per row. However, when I use the "Results to file" option, it exports it a...

Import tool Excel CSV...

I need an import tools for a web app. I've been looking around and found some, just not sure about their stability. I'm using the Zend Framework for part of the project and was hoping I could find an import tool there, since I already have the framework, but couldn't see one...am I looking in the wrong place? I would like the web us...

Ruby on Rails Moving from CSV to FasterCSV

I currently have the following code to parse a csv file using the standard csv library @parsed_file=CSV::Reader.parse(params[:dump][:file]) @parsed_file.each do |row| #some code end I want to move this to faster csv for the increased speed. Does anyone know the equivalent of the above for FasterCSV? Thanks ...

Python csv tags

I have a csv file with different headers. name,city john doe,chicago Have headers as reader = csv.DictReader(open(PATH_FILE),skipinitialspace=True) headers = reader.fieldnames How will you run a regex that whenever a tag [name] was to be proceesed it will show "john doe" ...

Help with line.split CSV

Hi, I'm a beginner, so please don't blast my work so far :) I'm trying to read in a CSV file and then see if it matches certain commands. Some of the data in the CSV has a period and I think it's messing up when I'm trying to split it. When I try to dump my arrays to see what's there, it always gets cut off after the period. Here is a da...

Encode East Asian languages using Python

This may not really be a Python related question, but pertains to language encoding in general. I'm mining tweets from Twitter, and it appears that there is a large Japanese user community (with messages in Japanese). When I tried encoding the tweets for an XML file I used utf-8. e.g tweet=tweet.encode('utf-8') and none of the Japanese t...

Google Adwords CSV File Parser

Hi! I'm using Google Adwords CSV export feature to parse some reports and format them the way I want. The problem is, however, that i can't find any CSV parser that is able to handle my adwords reports. The biggest issue is that column headers is not placed at the first row, but the sixth. Does anyone know a good CSV reader that is ab...

Is there a way to access a string as a filehandle in php?

I'm on a server where I'm limited to PHP 5.2.6 which means str_getcsv is not available to me. I'm using, instead fgetcsv which requires "A valid file pointer to a file successfully opened by fopen(), popen(), or fsockopen()." to operate on. My question is this: is there a way to access a string as a file handle? My other option is to ...

different line break characters in CSVs

I use LOAD DATA LOCAL INFILE to upload csv files to MySQL. If the csv was created by a mac, I include LINES TERMINATED BY '\r' in the query. If the csv was created by a MS Office, I include LINES TERMINATED BY '\n' in the query. If the csv was created in Open Office, I omit LINES TERMINATED BY altogether. Is there a way I can formula...

Regarding Java Split Command CSV File Parsing

I have a csv file in the below format. I get an issue if either one of the beow csv data is read by the program "D",abc"def,"","0429"292"0","11","IJ80","Feb10_1.txt-2","FILE RECORD","05/02/2010","04/03/2010","","1","-91","","" "D","abc"def","","04292920","11","IJ80","Feb10_1.txt-2","FILE RECORD","05/02/2010","04/03/2010","","1","-91...

Read two lines of CSV at a time (Java)

Is there a way to read two lines of a csv file at a time in Java? I can read one at a time using Scanner (it has to be done like this): String line = input.nextLine(); String[] nline = line.split ("[,]"); ...... Here is some sample data and a short explanation. I need these read two at a time so I can can go about my other processin...

search keyword in mysql field which has comma separated value

I have 2 tables resumes and category. Resume table stores only the category id and the category table stores the cat id and name. Resume table category field values has comma separated value for example 1, 4, 6, 9 . Now the problem is I have to search the keyword hotel management which has the category id 6 in category table. What is the...

How to use opencsv with my collection (list) ?

I need to parse 2 dimensional list, here is my schema list : list (size=12) ->[0] = "export.SampleJ:12432" --> id = 12432 --> dateCreatedSample = "Tue Feb 03 19:04:23 CST 2009" --> ttId = 0 --> chipId = 1012 --> ... ->[1] = "export.SampleJ:12433" --> id = 12433 --> ... ->[2] ... I tried : List<Strin...

Regarding CSV File Format SPLIT

I am planning to modify the file format so that each field should be enclosed in by double quotes mandatory "A","Field1","Field2","Field3","Fi"el,d","Fi""eld", I want the separator to be combined i.e to be ", (double quotes followed by comma) how do i change the below split command to include two separator ", (double quote and comma) tog...

Java Regex, capturing groups with comma separated values.

InputString: A soldier may have bruises , wounds , marks , dislocations or other Injuries that hurt him . ExpectedOutput: bruises wounds marks dislocations Injuries Generalized Pattern Tried: ".[\s]?(\w+?)"+ // bruises. "(?:(\s)?,(\s)?(\w+?))*"+ // wounds marks dislocations "[\s]?(?:or|a...

Reading first row as header is easy, what gives with two rows being the header

I have been using surveygizmo which is an amazingly powerful online questionnaire presenter. The data can be exported as a csv file but alas it has two [not one] header rows. The first row specifies the question and the second row contains possible responses that the respondent could have checked off. This seems highly aberant in the dat...

Proper way to parse this line with FasterCSV?

I have the following line in a CSV file that's giving me issues when parsing: 312,'997639',' 2','John, Doe. "J.D." ',' ','2000 ',' ','Street ','City ','NY','99999','','2010-02-17 19:12:04','2010-02-17 19:12:04'; I'm parsing with the following par...

python csv - export data and format color, text format, etc..

Hi, I'm exporting data from python with the csv library which works pretty good. After a web-search I can not find any information about how to format the exported data with python. For example. I export a csv row within python like this. for hour_record in object_list: row = list() for field in fields: ...

xls to csv with chainese character support

Hi, While saving an excel file with chainese character to csv, these characters are converting to ??? (Question marks) junk characters. Please let me know if any of you have any solution for this. I tried saving it in unicode text, it worked fine but when I tried saving it as .csv, its not working. Thanks ...