csv

Splitting huge file based on contents with ruby

Hi, Disclaimer: I'm not a programmer, never was, never learned algorithms, CS, etc. Just have to work with it. My question is: I need to split a huge (over 4 GB) CSV file into smaller ones (then process it with require 'win32ole') based on the first field. In awk it's rather easy: awk -F ',' '{myfile=$1 ; print $0 >> (myfile".csv")}' ...

Exporting SQL Server data to CSV

What’s the quickest way to export SQL Server data to CSV with ALL column fields enclosed in double quotes, including numeric fields? In the Results window of Management Studio, I can right click and choose “Save Results to CSV” but it doesn’t enclose fields in double quotes. I have looked into similar questions but the solutions propo...

parsing a CSV as XML via PHP

I found this script which parses a CSV file to XML. Problem is it seems to only be getting the first line of data after the column headers. function csv2xml($file, $container = 'data', $rows = 'row') { $r = "<{$container}>\n"; $row = 0; $cols = 0; $titles = array(); $handle = @fopen($file, 'r'); ...

implementing data grid using jquery

I need to read data from a csv file & display it as a data grid.The csv file contains name value pair i.e. column A will contain name & column B will contain its value.Also the user can add a blank row to the end of it & insert data manually by clicking on an add button.The user can select any row & delete the row completely by pressing ...

Execute SQL on CSV files via JDBC

Dear all, I need to apply an SQL query to CSV files (comma-separated text files). My SQL is predefined from another tool, and is not eligible to change. It may contain embedded selects and table aliases in the FROM part. For my task I have found two open-source (this is a project requirement) libraries that provide JDBC drivers: CsvJ...

Some characters in CSV file are not read during PHP fgetcsv()

I am reading a CSV file with php. Many of the rows have a "check mark" which is really the square root symbol: √ and the php code is just skipping over this character every time it is encountered. Here is my code (printing to the browser window in "CSV style" format so I can check that the lines break at the right place: $file = fopen(...

lowest common denominator when working with CSV and MySQL

I am working on a program to allow a user to edit data from either a MySQL DB table, or an uploaded CSV file. I am curious as to what format i can bring the two data types into where i can code a singular presentation model to present the data to the user. Should i convert the SQL to CSV, or try to go through both types and do something...

Loading a CSV into Core Data managed sqlite db

I have a CSV file containing data. I want to load it into a Core Data managed sqlite db. I just ran one of the sample Core Data Xcode apps and noticed it created the db file. I noticed table names all started with Z and the primary keys were stored in separate table so from this am I right in presuming that just importing the CSV data d...

submit file via form and handle it in a php function

I need to upload a file (in this case a csv file) and load the contents of it into the following function: function csv2xml($file, $container = 'data', $rows = 'row') { $r = "<{$container}>\n"; $row = 0; $cols = 0; $titles = array(); while (($data = fgetcsv($file, 1000, ',')) !== FALSE) ...

DateColumn is not getting displayed properly in CSV imported by asp page

Hello All, I am exporting data to .csv file from asp page. I am facing problem in the column which is showing date. Some date comes left aligned and some comes right aligned. As such there is no difference in the dates coming because I am just looping a recordset and writing the rs field which has datetime data. Note: When I append " ...

How do I parse out the fields in a comma separated string using sscanf while supporting empty fields?

I have a comma separated string which might contain empty fields. For example: 1,2,,4 Using a basic sscanf(string,"%[^,],%[^,],%[^,],%[^,],%[^,]", &val1, &val2, &val3, &val4); I get all the values prior to the empty field, and unexpected results from the empty field onwards. When I remove the expression for the empty field from th...

How to convert data to CSV or Html format.

In my application i need to export some data into CSV or html format. How can i do this. Any help will be greatly appreciated. ...

Comma Separated Value Files (Read/Write) - C#

Hey all, I've been very interested in CSV files for a few years now, but I never needed to use them until now, so I'm pretty new to this. I have an application that stores information about Controls that were created by the user at run-time. I plan on using CSV files to store this information which will be extracted at a later date by ...

Join characters using SET BASED APPROACH (Sql Server 2005)

I have a table where the data are like Data a b c I need to write a SQL Query to bring the following output Data abc Note:~ The number of characters are not constrained to 3. I have solved using while loop. But I have to do it using set based approach.So how can I join those characters? I tried using COALESCE but no luck Pl...

save (postgre) sql output to csv file

hi there, what is the easiest way to save PL/pgSQL output from a PostgreSQL database to a csv file? I'm using PostgreSQL 8.4 with pgAdmin III and psql plugin where I run queries from... thanks! martin ...

How to read a csv file in R where some numbers contain commas?

I have a large csv file with a mix of character and numeric columns. Some of the numerical values are expressed as strings with commas. e.g., "1,513" instead of 1513. What is the simplest way to read the data into R? I can use read.csv(...,colClasses="character"), but then I have to strip out the commas from the relevant elements before...

Extracting data from a CSV file in Python

I just got my data and it is given to me as a csv file. It looks like this in data studio(where the file was taken). Counts frequency 300 1 302 5 303 7 Excel can't handle the computations so that's why I'm trying to load it in python(it has scipy :D). I want to load the data in an array: Counts = [300, 302, 303] freque...

Converting List in Comma Separated List with linq?

I am having a info class with following field like id,name,address and i have created list of that info like List. I want to have all the values of list into comma seperated strings using linq. Is there any way for this. ...

csv parser in erlang

for my application i have to parse CSV file using Erlang.following is the code which will parse CSV using Erlang:- parse_file(Fn) -> {ok, Data} = file:read_file(Fn), parse(binary_to_list(Data)). parse(Data) -> lists:reverse(parse(Data, [])). parse([], Acc) -> Acc; parse(Data, Acc) -> {Line, Tail} = parse_line(Data), parse(Tail, [Line|...

Export Crystal Report to CSV Format

How to export the crystal report to .csv file format? ...