csv

A one-time generated CSV file in RoR

Is it possible to create a CSV file right out of the command line in IRB or elsewhere with a one-time use on it. Say, I just need a CSV file with all my user's first name on it. Can I create that without setting up any architecture? ...

Reading csv file

Help needed guys! I'm writing a simple import application an need to read a csv file. Show result in a datagrid and show corrupted lines of csv file in another grid, for example show the lines that are shorter than 5 values in another grid. I'm trying to do that like this: StreamReader sr = new StreamReader(FilePath); importingData = ne...

Append row to csv file Ruby 1.9 CSV lib

Using Ruby 1.9 and CSV lib, I can't seem to append a row. The example in the documentation opens the file, and overwrites the row. What is the correct way to append rows to the document? Example from documentation: require 'csv' CSV.open("path/to/file.csv", "wb") do |csv| csv << ["row", "of", "CSV", "data"] csv << ["another", "row...

reading csv file c#

is there any way to read a csv file into a matrix, so every square in the file will be a cell in the matrix? ...

Export CSV file in PHP

In exporting CSV file using PHP, there are some records that won't be included. It seemed like while transferring, it stopped even if there are still records to be exported. What's the problem? ...

Unexpected behaviour of getline() with ifstream

To simplify, I'm trying to read the content of a CSV-file using the ifstream class and its getline() member function. Here is this CSV-file: 1,2,3 4,5,6 And the code: #include <iostream> #include <typeinfo> #include <fstream> using namespace std; int main() { char csvLoc[] = "/the_CSV_file_localization/"; ifstream csvFile; ...

Merge Command in R

Hello, I have been playing around with the merge command in R and am trying to figure out how to use the SUFFIX parameter. The online documentation does not do a very good job at explaining it. What I'd like to do is import some csv files: data1<-read.csv("fileA", header=T) data2<-read.csv("fileB", header=T) And then use the merge c...

Trouble parsing CSV data when string contains a comma

I am parsing a CSV data feed sent to me via php. I am turning each line into an array of values. Here is my code: $fp = fopen('data.txt','r'); while (!feof($fp)) { $line = mysql_real_escape_string(fgets($fp)); $value_array = explode(',', $line); } But if one of the lines looks like this: "some company, inc.",XC34ET,500 ...

Using Weka Java Code - How Convert CSV (without header row) to ARFF Format?

I'm using the Weka Java library to read in a CSV file and convert it to an ARFF file. The problem is that the CSV file doesn't have a header row, only data. How do I assign attribute names after I bring in the CSV file? (all the columns would be string data types) Here is the code I have so far: CSVLoader loader = new CSVLoader(...

How do I get the data from a List<string[]> object contained inside a business object into a chart in Microsoft Reports?

Hi, I have a data object that is bound to a Report. In this object I have a List object that I am parsing a CSV file into for use in a chart. The binding to all the other items in my data object works fine, I can see them in my data sources browser, but the List object is another story. I only see the properties a List object exposes in...

Create a .csv file in C#

Alright I want to create a .csv file in C#. I have been looking around and noticed a lot of people are using the system.IO.memorystream and system.io.streamwriter. The problem is this: I have a web application. I want to give the user the ability to export to excel. Problem is, Excel cannot be installed on the server (don't ask). I want...

How do you export all tables to a CSV file using SQL Management Studio?

When I right click on the database I want to export data from, I only get to select a single table or view, rather than being able to export all of the data. Is there a way to export all of the data? If this is not possible, could you advise on how I could do the following: I have two databases, with the same table names, but one has ...

Exporting contacts from database to outlook using php

Hi guys I'm building a facility to be able to generate a csv file for import into outlook. However the thing is that my web application allows the user to enter unlimited contact entires i.e a contact can have unlimited telephone addresses, emails and other user defined fields which apprently aren't in outlook - yet I need a way to be ab...

Android writing to a CSV file via OpenCsv

I try to write to a Csv file via: mFileWriter = new FileWriter( "/sdcard/program/file"); mCsvWriter = new CSVWriter(mFileWriter); At the moment it throws an exception that the file doesn't exist. It's true that the file doesn't exist. What's the easiest way to create the file? ...

How do you control the output format of a date when writing a CSV file with FileHelpers?

I'm using the FileHelpers 2.0 library to write a CSV file using the ClassBuilder class to generate a record type. My data contains dates and so I create a field of type DateTime, but when the file is generated the date values come out in the format ddmmyyyy rather than dd/mm/yyyy e.g. 28042000 instead of 28/04/2000. I've set the DateFo...

Import specific columns of CSV in Excel 2007

Hello, I have a csv file, which consists of many fields (columns). However, I would like to import some columns while not others. Every time I am importing csv files with same structure and selecting columns one by one takes much time. How to automatically select the columns imported? DO I need a template or VBA code? (I am lack of pro...

How to efficiently search/replace on a large txt file?

I have a relatively large csv/text data file (33mb) that I need to do a global search and replace the delimiting character on. (The reason is that there doesn't seem to be a way to get SQLServer to escape/handle double quotes in the data during a table export, but that's another story...) I successfully accomplished a Textmate search an...

Change the delimiter in a csv export

Okay I have my csv builder essentially working. it has 3 columns. Name, Position, Date. Unfortunately right now the export has 4 columns. Last name, First name, position, date. This is because the data I get out of my data base for the name goes Last, First. Is there anyway I can easily change this delimiter? This would be very convenien...

Trouble creating csv for download

Using this lovely example I am getting some funky results. What I have is: Protected Sub btnCSV_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCSV.Click Response.Clear() Response.Buffer = True Response.ContentType = "text/csv" Response.AppendHeader("Content-Disposition", "inline; filename=" + Fil...

Use XSD to validate a CSV value?

I have an xml file with an attribute that looks something like this: <Element attribute="1234,2345,3413,6532" /> I need a way to validate that the attribute value is a comma separated list of integers within a certain range. Anyone know how to do this using XSD? Thanks! ...