csv

How can I convert an Excel file to CSV with Perl's Spreadsheet::WriteExcel?

I have an Excel sheet and am able to convert it into .csv format using Perl. My only problem is that some of my data in the Excel sheet cells contain commas and that has to be retained in the CSV format also, but while converting it takes as a seperator. How can I retreive the data in the cell with commas as it is and print it in the ...

Getline reading in a csv very oddly

I am trying to read a csv using get line to extract three variables separated by commas. Name, Course, and Grade. I am reading in the first line fine but it puts in weird new line breaks and sends the format into a cluster. Here is my code : #include "header.h" string student::GetCourse() { return course; } string student::GetNa...

Parse CSV string into Array of Integers

I have a text box field inputs 123,145,125 I to separate this field into an array of integers. And validate this field true or false if everything is parsed right. CODE: private bool chkID(out int[] val) { char[] delimiters = new char[] { ',' }; string[] strSplit = iconeID.Text.Split(delimiters); int[] intArr = null;...

How can I create a CSV file from unequal length arrays in Perl?

I have to parse a file so that I can import it to excel. So, I thought the best way was to create a csv file. In this file, I have to divide contents into different categories and represent them in different columns. So, I have parsed the file to create different arrays corresponding to the categories. Now, I am trying to create a csv fi...

Python - read in numric csv file, calc mean value of all entries in each row

Hi, could someone help me with a Python problem. I cant seem to find any code examples for the following scenario: Read in user specified csv file. Then for each row in file, calculate the mean & stddev for all numeric values in that row & print to screen. I know csv rows are read in a string so would need to be converted to a float pr...

Reading a csv file in Python with different line terminator

I have a file in CSV format where the delimiter is the ASCII unit separator ^_ and the line terminator is the ASCII record separator ^^ (obviously, since these are nonprinting characters, I've just used one of the standard ways of writing them here). I've written plenty of code that reads and writes CSV files, so my issue isn't with Pyt...

Sort a CSV by date in Python

Hi! I'm trying to sort a CSV file and I want the items sorted by date in reverse order: newest first. def SortCsvByField( filename, fieldNo, sep = ',' ): records = [line.split(sep) for line in file(filename)] As far as that it's pretty easy, but how do I compare dates? ...

in this case Csv or Mysql?

I am starting new project. In my project I will need to use local provinces and local city names. I do not want to have many mysql tables unless I have to have or csv is fast. For province-city case I am not sure which one to use. I have job announcements related with cities, provinces. For Csv case I will keep the name of city in anno...

determine schema field type in SQLite, CSV, or Excel

I am working on an Cocoa project using SQL databases, or CSV/Excel files as the input. Right now, I have hard-coded the SQL schema for the SQLie files I am importing (For example, the program would know that the first column is a STRING, second column is a INT... etc.). I am wondering if there's any C or Objective-C library or method to...

import CSV into SQLite WITHOUT a table schema

I know that I can import .csv file into a pre-existing table in a sqlite database through: .import filename.csv tablename However, is there such method/library that can automatically create the table (and its schema), so that I don't have to manually define: column1 = string, column2 = int ....etc. Or, maybe we can import everything ...

Duplicates without using While or Cursor in T-SQL

ID Name 1 A 1 B 1 C 2 X 2 Y 3 P 3 Q 3 R These are the columns in a table. I want to get output like ID Company 1 A,B,C 2 X, Y 3 P,Q,R Restriction is that I cannot use WHILE or CURSOR. Please write a query for the same. ...

How can I modify fields in a CSV file with Perl?

Hi, I have a csv file with following sample data. o-option(alphabetical) v-value(numerical) number1,o1,v1,o2,v2,o3,v3,o4,v4,o5,v5,o6,v6 number2,o1,v11,o2,v22,o3,v33,o44,v44,o5,v55,o6,v66 and so on.... Required output. NUM,o1,o2,o3,o4,o44,o5,o6 number1,v1,v2,v3,v4,,v5,v6 number2,v11,v22,v33,,v44,v55,v66 and so on... In this data...

Parsing a CSV file problems C#

Hi everyone, Having a problem with parsing a CSV file. I connect to the file using the following: string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\"" + dir + "\\\";" + "Extended Properties=\"text;HDR=No;FMT=Delimited\""; //create the database query string query = "SELECT * FROM...

Genshi: Nested for loops

I need to generate a HTML using a Genshi template. The Html is, basicaly a very long html with tables. The data comes in a simple CSV, so, i read it with python, i put it into a list[] and then i call the template and send the variable (the list) Actually i solved it by doing something like this in the template: <html> <?python> fo...

Uploaded file char-set conversion with Ruby

I have an application where we're having our clients upload a csv file to our server. We then process and put the data from the csv into our database. We're running into some issues with char-sets especially when we're dealing with JSON, in particular some non-converted UTF-8 characters are breaking IE on JSON responses. Is there a way ...

Gridview: Export to csv issue

Morning all - another day, another question from Rich! I have the following scenario. I have two methods of populating a GridView with data. These are as follows: protected void btSearch_Click(object sender, EventArgs e) { lqPackWeights.WhereParameters.Clear(); ControlParameter cp = new ControlParameter(); cp.Type = TypeCo...

How visible/traceable is local CSV data queried from an ASP.NET page?

I want to have a page on a remote site that selects a local CSV file as a data source which outputs to a GridView. What is the format of the source data and how is it transferred to the server in this instance? Could it be retrieved in some way from a cache or the IIS logs? The data is mildly sensitive and I'd like to know the potenti...

export to csv using fastercsv and CSV::Writer (Ruby on Rails)

What am I trying to do: export data to csv. I have a form which allows user to select the format (from a drop down menu). So based on the selection of the format the ouput is displayed using a ajax call. Works fine for html but when I select the format as csv I don't see any pop up on the screen (asking to save or open the file) and nei...

Write CSV To File Without Enclosures In PHP

Is there a native function or solid class/library for writing an array as a line in a CSV file without enclosures? fputcsv will default to " if nothing is passed in for the enclosure param. Google is failing me (returning results for a whole bunch of pages about fputcsv), and PEAR's libraries do more or less the same things as fputcsv. ...

Why linux sort is not giving me desired results?

I have a file a.csv with contents similar to below a,b,c a ,aa, a a b, c, f a , b, c a b a b a,a,a a,a,a a aa ,a , t I am trying to sort it by using sort -k1 -t, a.csv But it is giving following results a,a,a a ,aa, a a aa ,a , t a b a b a,a,a a , b, c a,b,c a b, c, f Which is not the actual sort on 1st column. What am I doin...