csv

Reading .csv in Python without looping through the whole file?

Hello, The only way I've seen Python's csv.reader used is in a for loop, which goes through the whole file without saving past values of the read in variables. I only need to work with 2 consecutive lines of the (enormous) file at a time. Using the csv.reader for loop, I only have 1 line at a time. Is there a way to use Python's csv mo...

Python script reading from a csv file

"Type","Name","Description","Designation","First-term assessment","Second-term assessment","Total" "Subject","Nick","D1234","F4321",10,19,29 "Unit","HTML","D1234-1","F4321",18,, "Topic","Tags","First Term","F4321",18,, "Subtopic","Review of representation of HTML",,,,, All the abov...

How to specify the delimiter when importing CSV files via OLEDB in C#

Hi, I need to perform a complex import in a Microsoft SQL Server 2000. Since doing it in a DTS is too complicated, I'm trying to do it with a little C# program, but I'm having problems when I need to import a CSV files: this file is using semicolons as field delimiters instead of commas and I can't get the .NET's OLE DB provider to reco...

Where is the now free UK postcode data to be found?

By all accounts the UK postcode address file (PAF) - a list of postcode with the matching addresses - is free now. I've had a good old nosey on the OS OpenData site (http://www.ordnancesurvey.co.uk/oswebsite/opendata/) but can't seem to find it. I can find geocoding stuff for each postcode BUT I want the addresses for each postcode. Or...

what is the best way to edit csv file

I have a incomplete csv file that needs to be accurately updated, so there is csv file like this : one,two,three,four,five,six,seven,eight,nine,ten //This is a line(String) Naturally the file is far more complex but in this format, here is what I want to do insert new-word,new-word1, new-word3 or n words between seven and eight(or any...

effeciently read large spreadsheet file in C++

I normally use the method described in csv parser to read spreadsheet files. However, when reading a 64MB file which has around 40 columns and 250K rows of data, it takes about 4 minutes. In the original method, a CSVRow class is used to read the file row by row, and a private vector is used to store all the data in a row. Several thin...

Generating a CSV list from Linux 'ps'

Suppose I have a ps command that looks like this: ps -Ao args:80,time,user --sort time It will give me a "space" separated set of rows. A row might look like this paulnath -bash 00:00:00 I would like to convince ps to delimit by commas(or tabs even!), such that it can be processed automagically by other languages. Please note that...

The best way to extract data from a CSV file into a searchable datastructure?

I have a csv file with 48 columns of data. I need to open this file, place it into a data structure and then search that data and present it in a DataRepeater. So far I have successfully used CSVReader to extract the data and bind it to myDataRepeater. However I am now struggling to place the data in a table so that I can filter the re...

How to define column headers when reading a csv file in Python

I have a comma separated value table that I want to read in Python. What I need to do is first tell Python not to skip the first row because that contains the headers. Then I need to tell it to read in the data as a list and not a string because I need to build an array out of the data and the first column is non-integer (row headers)....

What is the best way to create XLS file in PHP

Hey Everyone, I am currently trying to figure out the best way to create a .xls file from PHP. It seems like to me that all I need to do is change the header content type to "application/vnd.ms-excel", and then output data in a comma separated format. Is this the best way to do this? Thanks for any help!Metropolis EDIT Would it be ba...

whats the best way to read a csv file from a url in C#

i have a url when i click on it i get windows asking me what to open it in and it recommends excel. I now want to read this csv data dynamically in a c# application. what is the best way of getting csv data from Http Request to a url? ...

Creating and Editing Excel Documents (.csv) with Java

Hello everyone! For this project I'm working on, I want to take multiple excel sheets and then merge them into one, manipulating the data as I please to make everything a little more readable. What would be the best way to open files, read their contents, store that content, create a new file (.csv), then paste the information in the o...

is there a way to remove the first line from a StreamReader

i have a streamreader which loads up a csvfile, the issue is that there is one extra row at the top of the data that i want to ignore. I am using the CSVReader project which is great but csv.GetFieldHeaders(); always looks at the first row. Instead of going into the CSVReader source code and changing it, i thought it might be easi...

How to iterate through a MySQL table with Python?

Hi, I have a Python script which uses the MySQLdb interface to load various CSV files into MySQL tables. In my code, I use Python's standard CSV library to read the CSV, then I insert each field into the table one at a time, using an INSERT query. I do this rather than using LOAD DATA so that I can convert null values and other minor c...

Reading/writing CSV/tab delimited files in c#

I need to read from a CSV/Tab delimited file and write to such a file as well from .net. The difficulty is that I don't know the structure of each file and need to write the cvs/tab file to a datatable, which the FileHelpers library doesn't seem to support. I've already written it for Excel using OLEDB, but can't really see a way to wr...

How to Select row range wise in SQL Server

I Have a very large database in SQL Server ( around 20 Million Rows ). I have to take backup of that database in .csv format. But .csv supports only 1 million rows in a single file. So I am not able to take backup of whole database. So I have to break that database in 20 Parts. For that I have to select 1-1 Million then 1 million to 2 m...

can awk deal with csv file that contain comma inside a quote

I am using awk to perform counting the sum of one column in the csv file. The data format is something like: id, name, value 1, foo, 17 2, bar, 76 3, "I am the, question", 99 I was using this awk script to count the sum: awk -F, '{sum+=$3} END {print sum}' Some of the value in name field contains comma and this break my awk script....

Super CSV (Java) - Read Files with Spaces in Column Names

Hey everyone! I'm working with Super CSV and it looks like an amazing package. My only worry is how to work with columns with spaces in their names. No, I cannot go back and remove the spaces myself. These files will be given to me by the hundreds and I don't have time to go back and fix all 60 columns for each file and I can't trust e...

Cannot find Main Class in File Compiled With Ant

I compile and run my program in Eclipse and everything works fine, but when I package it with Ant and run it, I get this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/supercsv/io/ICsvB eanReader Caused by: java.lang.ClassNotFoundException: org.supercsv.io.ICsvBeanReader at java.net.URLClassLoader$1.run(Un...

Need Help Inserting Double or Single Quotes

Hi everyone, I have a long list of names that I need to have quotes around (it can be double or single quotes) and I have about 8,000 of them. I have them in Excel without any quotes and I can copy all of the names and paste them no problem but there are still no quotes. I have looked and looked for an Excel formula to add quotes to the ...