csv

How to change list to CSV, and vice versa, in PHP.

I have a text file like.... [email protected] [email protected] [email protected] [email protected] [email protected] I want to convert it to CSV with the help of a little bit PHP, and I want to know also how it can be reversed...ie from CSV to an ordered, or un-ordered list.....kindly help me please :) ...

How can I declare a thousand separator in read.csv?

The dataset I want to read in contains numbers with and without a comma as thousand separator: "Sudan", "15,276,000", "14,098,000", "13,509,000" "Chad", 209000, 196000, 190000 and I am looking for a way to read this data in. Any hint appreciated! ...

python csv header error

Trying to read headers for a csv file with: reader = csv.DictReader(open(PATH_FILE),skipinitialspace=True) headers = reader.fieldnames for header in sorted(set(headers)): It worked on development server, throws this error on production 'NoneType' object is not iterable Debug shows headers has None value while the csv file has head...

overwriting column with fputcsv

I want to parse, process and then overwrite only 1 specific column in a csv file, I'm fine with the first two steps but am having issues with the third. Here's what I have so far: <?php $fh = fopen("data.csv", "r"); $row = 1; while (($data = fgetcsv($fh, 1024, ",")) !== FALSE) { $get = $data[2]; $uc = ucwords(strtoupper($get)); echo $uc...

Excel VBA - Parse Server Logs

heya, We have a small project that involves automatically parsing some server/mail logs (among other things). Now, Plan A was to just hack together some Python and Django to do this properly grins, but I got veto-ed and the solution has to be pure-Excel, as it's believed that will be more portable. 1. Importing tab-separated file Our ...

FileHelpers and CSV: what to do when a record can expand unbounded, horizontally

I'm trying to parse this type of CSV file with FileHelpers: Tom,1,2,3,4,5,6,7,8,9,10 Steve,1,2,3 Bob,1,2,3,4,5,6 Cthulhu,1,2,3,4,5 Greg,1,2,3,4,5,6,7,8,9,10,11,12,13,14 I can't figure out how to parse this with FileHelpers. I would imagine I should be able to do something like this: [DelimitedRecord(",")] public class MyRecord { ...

Timezone lookup

Hello everyone, I have a file that contains the following in a csv file; country,region,city,postalCode,metroCode,areaCode I need to find the time zone for the entries. I have seen olson database and geonames, i was lost with olson database. couldnt find anything useful. is there any web site i can access the time zone information ba...

Server generated CSV attachment, when opened in Excel has weird sheet name

I have my server generate and outputs csv file which the browser then pops up a open/save dialog. When I open it up, all is well except the sheet name. The sheet name is mangled. If my filename is CsvData.csv for example, then let's say I download it several times, you'll eventually see the sheet name turn into something like: .csv]Cs...

how to read an excel file on google app engine

Generally I work with CSV files but for this project I need to support XLS too. Does anyone have experience reading XLS files on GAE with Python? 2 possible alternatives I am considering: xlrd Google Docs API ...

Export CSV from JDE

I need to import data from JD Edwards into MSSQL database. But I have some difficulty importing the CSV file (I'm using SSIS 2005). In the CSV files, total 18 columns, but there are only 16 comma delimiters. By right with 18 columns, there should be 17 comma delimiters, but the comma delimiter for the last column (which all null) never...

append new row to old csv file python

hi, I am trying to add new row to my old csv file. Basically it get update each time when I run the python script. Right now I am storing the old csv rows values in list and then deleting the csv file and creating it again with the new list value. Wanted to know is there any better ways of doing it. Thanks ...

Magento order import export

Is there a way to import/export orders by CSV in Magento? I thought I could do this with profiles but if i try to create a new profile it makes me choose only between customers and products. I looked for an extension but i haven't found anything (anyway i'm looking for something free). Have you got some suggestions? ...

Searching a CSV File Using Grep

Lets say I have a csv file like this: a,b1,12, a,b1,42, d,e1,12, r,12,33, I want to use grep to return only only the rows where the third column = 12. So it would return: a,b1,12, d,e1,12, but not: r,12,33, Any ideas for a regular expression that will allow me to do this? ...

C++ stream operator question

Hi all, I suppose this might be simple question for all the gurus here but I somehow couldn't figure out the answer. I want to be able to write csv cells to stream as simple as this: stream << 1 << 2 << "Tom" << std::endl; which would create output like 1,2,Tom. How can I achieve that? I figured that I need to create custom streambu...

fputcsv and Notepad

I generate csv files with fputcsv and it works just fine, but when I view the csv file in Notepad (Windows) there is no new lines. All lines are in just 1 line, and where the linebreak is supposed to be, there is a sqaure (corrupted character). Other editors on Mac for example show the lines with breaks correctly. Is there any way to fi...

How to store the contents of an array into a CSV file and save it in a location in php

Hi, I have an array which has the contents as the result of an sql query. I have been able to convert them into a CSV as well in the below format 2; Testing; IPTV; 9886784; 50061; 28/2/10 09:30:01 AM; 3; Testing; IPTV; 9886784; 50061; 1/3/10 09:30:01 AM; 4; Testing; IPTV; 9886784; 50061; 2/3/10 09:30:01 AM; 5; Testing; IPTV; 9886784; ...

how to import in csv

Hi, I m having a porblem.I m exporting data to an excel in my django admin.The functionality is fine until some special characters are not there. I have a text " ACTPrinter ★ Print to iPhone " when i try to export this to an csv file , it gives an error UnicodeEncodeError at /admin/core/wappubfilter/ 'ascii' codec can't encode ...

jquery php and csv exporting

i have a script for exporting results of a mysql query as a csv file. The thing is that i use jquery to access the script. I need to know how i can return the data (already in csv format) with jquery. In other words, just to make myself clear because my english is a bit poor, when the user presses a button in the html file, a post reques...

Filter a csv file by a word or text using php

I have another csv file where I am trying to do a simple word filter. For example, my text.csv file looks something like this: name, age, hobbies Tom, 8, "football, soccer, baseball, wii, star wars, books" Bill, 9, "football, baseball, ice hockey, basketball" Sue, 8, "baseball, soccer, volleyball, bicycles, skating" Mike, 8, "basketbal...

Best way to convert csv data to dict

Hi, I have csv file with following data val1,val2,val3 1,2,3 22,23,33 So how can I convert data into dict dict1 = { 'val1': 1, 'val2': 2, 'val3': 3} dict2 = { 'val1': 22, 'val2': 23, 'val3': 33} fp = open('file.csv', 'r') reader = csv.reader(fp) for row in reader: ???? Thanks ...