csv

Tool to correct invalid CSV files

Is there any command-line tool or ruby library to clean/correct invalid .csv files, something like tidy for html? Example of error: unescaped non-successive double quotes. Related to: Regular expression to find and replace unescaped Non-successive double quotes in CSV file. ...

With JS, jQuery, how do I save an AJAX response to a (text) file?

It seems like this question is asked periodically and the common response is "You shouldn't do that with AJAX anyway. Just set the window location to the file." But I'm trying to request a file that doesn't actually exist out on the server anywhere. It's dynamically generated (by a Django view) given the GET/POST context parameters. The...

In Scala, how to find an elemein in CSV by a pair of key values?

For example, from a following file: Name,Surname,E-mail John,Smith,[email protected] Nancy,Smith,[email protected] Jane,Doe,[email protected] John,Doe,[email protected] how do I get e-mail address of John Doe? I use the following code now, but can specify only one key field now: val src = Source.fromFile(file) val iter =...

How to import CSV file to MySQL table

I have an unnormalized events-diary CSV from a client that I'm trying to load into a MySQL table so that I can refactor into a sane format. I created a table called 'CSVImport' that has one field for every column of the CSV file. The CSV contains 99 columns , so this was a hard enough task in itself: CREATE TABLE 'CSVImport' (id INT); A...

gnuplot ignores divisor of csv-column values

I am using gnuplot to draw a histogram of a series of RAM measurements I performed. However, I want it to display the values that are stored in Bytes in CSV files in KB. I divided the respective columns by 1024, but gnuplot simply ignores that. Below you see the template that is changed by a script to have meaningful file names for CSVF...

Output CSV to download via jquery

UPDATE: Solved via: append = append+'/output/'+output; var url = '/producer/json/index/period/'+period+'/empties/'+empties+'/movies/'+movies+'/fields/'+fields+'/start/'+start+'/end/'+end+append+''; $.ajax({ url: ''+url+'', success: function(msg) { ...

Import from csv (into different columns) via Openrowset and Microsoft.ACE.OLEDB.12.0

I want to clarify how I could import data from .csv into table with 3 columns (see CR Ranking.csv below). My query: select * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=C:\Work\;HDR=Yes;', 'SELECT * FROM [CR Ranking.csv]'); Outputs results into one coulmn: header: Category;INfo;Rank row 1: Category 1;Info;1 row 2: Ca...

An item with the same key has already been added - csvreader.fieldcount

Hi, I'm trying to create an import program from CSV. My code is csv = New CsvReader(New StreamReader("CSVFileLocation"), True) Dim fieldCount As Integer = csv.FieldCount The error message "An item with the same key has already been added." on the second line. If I changed "HasReaders" to "False", there's no such error. But, I'm not ...

How to serialize object to CSV file?

I want to write a Object into CSV file. For XML we have XStream like this So if i want to convert object to CSV do we have any such library ? EDIT: I want to pass my list of Bean to a method which should write all the fields of bean to CSV. ...

Unset uploaded files in PHP

I have a Form that I am using to receive an uploaded .csv file, parse it and insert the data into my MySQL db on an Apache server. The page first checks to see if there is an uploaded file. If there is, it processes the data, if not the form (below) is displayed. <form enctype="multipart/form-data" action="uploadfaculty.php" method="P...

How to convert CSV data to paring array data using javascript?

I'm trying to convert CSV data into paring array data, but I'm totally new to javascript, and I don't know how to do it now. Does any one have some idea? Thanks in advance! CSV data: year,USA,EU,UK,China,India 2003,10882,10970,1795,1575,599 2002,10383,9040,1564,1434,510 2001,10020,8303,1430,1345,479 2000,9762,8234,1438,1252,457 1999,9...

CSV jsp generated file, how to insert a break line

Hi all, I am trying to generate a csv file using a jsp file this its code: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%-- Set the content type --%> <%@ page contentType="text/csv"%> <c:forEach items="${chartData}" var="chartDataEntry" varStatus="status"> ${chartDataEntry.date}, ${chartDataEntry.open}, ${chartDa...

Get file's encoding in Java

Possible Duplicate: Java : How to determine the correct charset encoding of a stream User will upload a CSV file to the server, server need to check if the CSV file is encoded as UTF-8. If so need to inform user, (s)he uploaded a wrong encoding file. The problem is how to detect the file user uploaded is UTF-8 encoding? The ba...

Yahoo! Finance CSV file will not return Dow Jones (^DJI)

I am trying to retrieve market data from Yahoo! finance and the script has worked fine for years, but recently, it stopped showing The Dow Jones data. Here is the URL: http://download.finance.yahoo.com/d/quotes.csv?s=^DJI,^IXIC,^GSPC,^TNX&amp;f=snl1d1t1c1ohg The URL should return data on: Dow Jones NASDAQ S&P 10 Year Bonds It actua...

Trouble importing csv file with ruby CSV Module

I'm trying to use Ruby's csv module to import the records contained in a csv file to my local table in a Ruby on Rails 3 application. The table was created through the creation of model Movie. Here is what I've been executing in console: require 'csv' CSV.foreach('public/uploads/VideoTitles2.csv') do |row| record = Movie.new( ...

repair data in csv file

Hi, I have a huge csv file, separated by comma's and I want to do a analysis with glm in R. In one column there exists data with a comma implied, something like: bla,blabla When reading the file in R with read.csv.sql there comes a error-message: RS-DBI driver: (RS_sqlite_import: ./agp.csv line 47612 expected 37 columns of data but f...

Linq's Aggregate Function, How to make a CSV String

I'd like to make a comma seperated value string with Linq's Aggregate function. Anyone know how to do this? Given an array of strings like this: var authors = new string[] {"author 1", "author 2", "author 3"}; How do I get a single string like this author 1, author 2, author 3? I'm thinking something like authors.Aggregate(author => ...

Writing to a particular cell using csv module in python

I have to write a value to a particular cell (say the 8th cell) in my csv file. I can see there is a csvwriter.writerow(row) method to write an entire row, but I am not seeing anything to write a value to a particular cell. ...

How to show a comma within a comma separated file

I'm generating a csv file using php, now some columns contain a paragraph with commas, now when I open the file , every comma within the file counts as a new column, is it maybe possible to escape these commas on a way? ...

Is there a Python package to parse readable data files with sections

I am looking for a method to parse readable (i.e., not binary) data files with sections. I had been using ConfigObj to read config files (INI files?), but I ran into a problem with multi-line lists. Specifically, ConfigObj does not allow list members to contain carriage returns. In other words, the following fails to parse: [section] d...