csv

How to return fully populated objects using FileHelpers for partially complete data?

Assume you have a CSV file with the following structure LINE1: ID,Description,Value LINE2: 1,Product1,2 LINE3: ,,3 LINE4: ,,4 LINE5: 2,Product2,2 LINE6: ,,3 LINE7: ,,5 With the corresponding FileHelpers definition class [DelimitedRecord(",") ] [IgnoreFirst(1)] public class Product { public int ID { get; set; } ...

problema apertura file .csv

Hello. I am the beginning and would like to help. Should I open a. Csv file is 1937335 KB large. I downloaded CSVed but when I go to open it I get the following message: "Error loading ..... with. Csv" What can I do? ...

primary key in linked csv using schema.ini somehow?

For a number of reasons I have to use a linked csv file in a sqlexpress database. Col1 is always unique, although the data changes periodically, based on current logins. Is there a way to set as a primary key in some manner using the schema.ini or some other way? ...

Python Unicode CSV export (using Django)

Hi All, I'm using a Django app to export a string to a CSV file. The string is a message that was submitted through a front end form. However, I've been getting this error when a unicode single quote is provided in the input. UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 200: ordinal not in rang...

parse csv file php

I have a csv file that I want to have php use. The first thing in the csv are the column names. Everything is separated by commas. I want to be able to have the column names be the array name and all the values for that column would be under that array name. So if there were 20 rows under column1 then I could do column1[0] and the the ...

How do I split apart a CSV string in Ruby?

Hi all. I have this line as an example from a CSV file: 2412,21,"Which of the following is not found in all cells?","Curriculum","Life and Living Processes, Life Processes",,,1,0,"endofline" I want to split it into an array. The immediate thought is to just split on commas, but some of the strings have commas in them, eg "Life and L...

Convert array into csv

Hi, I would like to ask on how to convert array into csv file. this is my array: stdClass Object ( [OrderList_RetrieveByContactResult] => stdClass Object ( [OrderDetails] => stdClass Object ( [entityId] => 1025298 [orderId] => 10952 [...

Find and replace in CSV files with Python

Related to a previous question, I'm trying to do replacements over a number of large CSV files. The column order (and contents) change between files, but for each file there are about 10 columns that I want and can identify by the column header names. I also have 1-2 dictionaries for each column I want. So for the columns I want, I want...

Awk conditional sum from a CSV file

I have a CSV file from which I would like to extract some pieces of information: for each distinct value in one colum, I would like to compute the sum of the corresponding values in another column. Eventually, I may do it in Python, but I believe there could be a simple solution using awk. This could be the CSV file: 2 1:2010-1-bla:...

Spread sheet Data import engine

We are developing a web application which has a requirement of importing spread sheet data of any format like excel or database table and parse into csv (with first column as heading) and re-import it into our data grid We are looking to develop it ground up (may be trying to re-invent the wheel) I would appreciate if anyone provi...

Is there a way to use read.csv to read from a string value rather than a file in R?

I'm writing an R package where the R code talks to a Java application. The Java application outputs a CSV formatted string and I want the R code to be able to directly read the string and convert it into a data.frame. ...

Modify CSV field on import to mysql

I'm trying to import a CSV file to a mysql database. The CSV file contains (amongst other things) dates in the following format: "2010-04-31 17:43:12" My first approach was to use the following .sql script: USE test; LOAD DATA INFILE '/tmp/test.cvs' replace INTO TABLE test_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (......

how to import table in txt to mysql, with garbage on top and bottom of the file?

Let say I have a file with 20 lines, the first 3 lines are useless instruction for using the table, the 4th line is the header, the 5th to 17th lines are tab-delimited data, and the 18th to 20th lines are some useless remarks. And I want to import the table from the 4th line to the 17th line. How can I do it in MySQL? Something to work w...

csvreader.fieldnames not recognized as an attribute of a csv reader object in python

I am trying to extract the header of a CSV file in Python by using the CSV module. The CSV file is quite flat, and looks something like: This, That, The Other 1, 2, 3 I am doing the following: Read in the CSV file and make the reader object push the reader's iterator to the next line to force it to access the first line at...

How do you dynamically identify unknown delimiters in a data file?

I have three input data files. Each uses a different delimiter for the data contained therein. Data file one looks like this: apples | bananas | oranges | grapes data file two looks like this: quarter, dime, nickel, penny data file three looks like this: horse cow pig chicken goat (the change in the number of columns is also intent...

How to update object values (based on the curr-previous pattern)?

Assume you have a CSV file with the following simplified structure LINE1: ID,Description,Value LINE2: 1,Product1,2 LINE3: ,,3 LINE4: ,,4 LINE5: 2,Product2,2 LINE6: ,,3 LINE7: ,,5 I am using FileHelpers to read the CSV and have hooked up one the interfaces that allows me me to access the current line, after it has been r...

How to migrate a CSV file to Sqlite3 (or MySQL)? - Python

Hi folks, I'm using Python in order to save the data row by row... but this is extremely slow! The CSV contains 70million lines, and with my script I can just store 1thousand a second. This is what my script looks like reader = csv.reader(open('test_results.csv', 'r')) for row in reader: TestResult(type=row[0], name=row[1], res...

good tool to quickly import some csv data into sql server

Every once in a while I find myself typing a one-off script to import some CSV data into a database, doing some column logic (e.g. turn column3 into uppercase) and/or field mapping (column2 in the csv goes to column 3 in de database, etc). Is there a nice tool which can do this easier? The least amount of features I'd need is: choos...

What library to use for CSV import in c#

Hi, I've looked at FileHelpers v2.0 but there is a serious problem woth that. I cannot define a class that maps to the record in the source/detination file. The reason is I don't know what file I'm going to get. A big part of my program is mapping the file's fields to the database's fields... I don't know how many fields there wil be, ...

Ruby: How can I process a CSV file with "bad commas"?

I need to process a CSV file from FedEx.com containing shipping history. Unfortunately FedEx doesn't seem to actually test its CSV files as it doesn't quote strings that have commas in them. For instance, a company name might be "Dog Widgets, Inc." but the CSV doesn't quote that string, so any CSV parser thinks that comma before "Inc." ...