csv

How to loop a Magento collection?

Basically, I need to get a CSV file of my customers, generated automatically in a script every day. I've tried several ways, but they are too slow or actually exhausted of memory. *1) foreach through collection resource * $collection = Mage::getResourceModel('customer/customer_collection') ->addAttributeToSelect('email') ->addAttribute...

How To Use the CHCSVParser class

Hello all (but mostly Dave), I am playing around with Dave DeLong's excellent CHCSVParser for Objective-C with an extremely long .CSV file and am running into some trouble using it. I would use the arrayWithContentsOfCSVFile method, but I'm running the code on an iPhone and parsing the whole file into memory would take more memory than...

Outputting escaped characters in django templates

I want to use the django templating system to output csv like data which looks like; !connection%block !dosomething !dosomethingelse My,Header,Row,Which,Is,Comma,Seperated All,My,Comma,Seperated,Data All,My,Comma,Seperated,Data All,My,Comma,Seperated,Data All,My,Comma,Seperated,Data !Footerblock !that has footer information The actual...

Exported CSV download stuck in firefox

I'm exporting a CSV to firefox using the following code: string csv = dataTable.ToCSV(); Response.ClearContent(); Response.AddHeader("Content-disposition", "attachment;filename=solicitud.csv"); Response.AddHeader("Content-length", (Encoding.Unicode.GetBytes(csv).Length).ToString()); Response.ContentType = "application/excel"; Response.C...

separating names

Im trying to Separate Last name, First Name and Middle Initial. File is csv format, here is an example: A0001,3,Y,13,LU, A0001,3,Y,13,CLARK P, A0001,3,Y,13,SMITH JOHN, A0001,3,Y,13,BEAL KRISS J, A0001,3,Y,13,THOMAS A CLIFF C, A0001,3,Y,13,DEW III ROBERT H, Output fields : Last name First name I...

foo.split(',').length != number of ',' found in 'foo'?

Hi, Maybe it's because it's end of day on a Friday, and I have already found a work-around, but this is killing me. I am using Java but am .NET developer. I have a string and I need to split it on semicolon comma. Let's say its a row in a CSV file who has 200 210 columns. line.split(',').length will be sometimes, 199, where count of '...

Can I optimize this code??

I am trying to retrieve the data from the table and convert each row into CSV format like s12, james, 24, 1232, Salaried The below code does the job, but takes a long time, with tables of rows exceeding 1,00,000. Please advise on optimizing technique: while(rset1.next()!=false) { sr=sr+"\n"; ...

Finding Duplicates (Regex)

I have a CSV containing list of 500 members with their phone numbers. I tried diff tools but none can seem to find duplicates. Can I use regex to find duplicate rows by members' phone numbers? I'm using Textmate on Mac. Many thanks ...

FasterCSV importer to DataMapper model - No rows inserted

I have a model (called Test): property :id, Serial property :title, String, :length => 255, :required => true property :description, String, :length => 255, :required => true property :brand, String, :length => 255, :required => true property :link, String, :length => 255, :required => ...

Wrap CSV values generated by PHP fputcsv() with " "

So, my code generates a CSV file using PHP's built-in fputcsv function. For the delimiter, I use ',' (a comma). For the enclosure, I use '"' (a double-quote). However, when I try something like fputcsv($file,array('a','b',"long string, with commas",NULL,''),',','"'); it outputs a,b,"long string, with commas",, but I would like i...

Why does RubyGems FasterCSV process [[1,3,5], [2,4,6]].to_csv as "135,246\n"

the following code: [1,3,5].to_csv => "1,3,5\n" # this is good [[1,3,5], [2,4,6]].to_csv => "135,246\n" # why doesn't it just do it for array of array? but require this instead: data = [[1,3,5], [2,4,6]] csv_string = FasterCSV.generate do |csv| data.each {|a| csv << a} end => "1,3,5\n2,4,6\n" or shorter: data =...

Reading and checking .csv file and then uploading it to the sql server 2008 r2

Hi, I have got a page in which there is a file upload option where I have to upload/import the csv file. What I want to do is to check if the correct format of file is uploaded for instance if any other than csv file is uploaded, the system should give an error message. Also what I need to do is to check certain fields of the csv file f...

How do I read a CSV file containing non-ASCII characters in Perl?

I am using Text::CSV to parse a csv file. Not all lines can be parsed, because of some bad characters. The Text::CSV documentation says: Allowable characters within a CSV field include 0x09 (tab) and the inclusive range of 0x20 (space) through 0x7E (tilde). How can I filter out as easy as possible any not-allowed characters? ...

import degree symbol (°) from excel or csv file to mssql database

I have a field in my csv file which contains the text: Frozen at 20°C but when i import into my database it appears as: Frozen at 20�C anyone know how i can keep the correct degree symbol? my import code looks like this string fieldValue = csv[i].Trim(); ...

Numpy csv script gives 'ValueError: setting an array element with a sequence'

I have a python script that successfully loads a csv file into a 2d numpy array and which then successfully extracts the value of a desired cell based on its column and row header values. For diagnostic purposes, I have the script print the contents of the data matrix before it is put into a numpy array. The script works when the data ...

CSV-Mapper No such file or directory

I am using the csv-mapper gem to import a csv file. When I use the example code on in the README (http://github.com/pillowfactory/csv-mapper) in script/console it works great. However, when I create a web form and use that to upload a csv file I get the error "No such file or directory - test.csv These are the parameters: Parameters: {...

mysql to csv without using INTO OUTFILE of mysql

Hi there, I need to export data from mysql to a csv file with column heading but i dont have file permission on the server. Is there any otherway to do it? i.e. using php fwrite? or fputcsv? Any help will be much appriciate. Thanks. ...

Can I format data that is to be written in CSV file using java.

Hello All! I written a code to write data into a csv file, but It will write data into csv without formatting. I want to bold some specific text.Is is possible to write csv file with formatted data in java. Thank You! ...

XML to CSV, only getting one line?!?

I'm having trouble with this XML to CSV Script.. when I remove the headers everything echos but with them I only get the last line of the CSV file. I turned off E_NOTICE warnings as not all of the delivery-requests have customer-ref1 and I'm not sure how to test for this isset() doesn't seem to work. I suspect that it may be part of the...

Locations of CSV files in Android

I'm having trouble reading in from a .CSV file in an android app. Mainly a "FileNotFound" error. Where would be the easiest place to put the file, and what would be the address to it. I have been messing around with a few different places but have had no luck. Can anyone point me in the right direction? ...