csv

Octave: importing a large matrix in csv format

I'm trying to import a matrix (about 80.000 rows) from a csv file to Octave. The obvious solution seems something like: load("-ascii","relative_directory/the_file.csv") or maybe renaming the file and trying: load("-ascii", "relative_directory/the_file.txt") Yet I keep getting the error: load: failed to read matrix from file "...

How to current snapshot of MySQL Table and store it into CSV file(after creating it) ?

I have large database table, approximately 5GB, now I wan to getCurrentSnapshot of Database using "Select * from MyTableName", am using PDO in PHP to interact with Database. So preparing a query and then executing it // Execute the prepared query $result->execute(); $resultCollection = $result->fetchAll(PDO::FET...

how to merge 200 csv files in Python

Guys, I here have 200 separate csv files named from SH (1) to SH (200). I want to merge them into a single csv file. How can I do it? ...

How to bulk insert from CSV when some fields have new line character?

I have a CSV dump from another DB that looks like this (id, name, notes): 1001,John Smith,15 Main Street 1002,Jane Smith,"2010 Rockliffe Dr. Pleasantville, IL USA" 1003,Bill Karr,2820 West Ave. The last field may contain carriage returns and commas, in which case it is surrounded by double quotes. And I need to preserve...

Ruby on Rails export to csv - maintain mysql select statement order

Exporting some data from mysql to a csv file using FasterCSV. I'd like the columns in the outputted CSV to be in the same order as the select statement in my query. Example: rows = Data.find( :all, :select=>'name, age, height, weight' ) headers = rows[0].attributes.keys FasterCSV.generate do |csv| csv << headers rows.each do ...

How to create a csv Excel file from content in a gridview in WPF?

Hi! I would like to export to a csv file the content of a gridview in WPF. Which is the best and efficient way to do it? Thanks! ...

php fputcsv and enclosing fields.

I was just about to ask the same questions as the question aksed here.... http://stackoverflow.com/questions/2489553/forcing-fputcsv-to-use-enclosure-for-all-fields The question was When I use fputcsv to write out a line to an open file handle, PHP will add an enclosing character to any column that it believes needs it, but wi...

Convert XML file to CSV

After having converted a messed up XML using regex, I now need to change it yet again. This source file <product> <sku>SP00001</sku> <PID_OWNER_SellerID>StoreName</PID_OWNER_SellerID> <EANCode>8711983489813</EANCode> <DeliveryDays>2</DeliveryDays> </product> Has to become a CSV file, but like this: sku field ...

Unable to execute fetch(PDO::FETCH_ASSOC) and not updating csv file.

// First, prepare the statement, using placeholders $query = "SELECT * FROM tableName"; $stmt = $this->connection->prepare($query); // Execute the statement $stmt->execute(); var_dump($stmt->fetch(PDO::FETCH_ASSOC)); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo "Hi"; // Export every row to a file fputcsv($data, $row); } Is t...

Does Chrome always adds an XLS extension on a vnd.ms-excel mime type?

It seems that a simple download of a PHP generated CSV file (with a vnd.ms-excel mime type for the sake of opening it with (Open)Office readly upon the "Save as..." dialog, when present) always gets the unwanted .xls extension when the UA is Google Chrome. The file would then be named as myfile.csv.xls. Firefox behaves correctly. I wonde...

Mathematica - Import CSV and process columns?

I have a CSV file that is formatted like: 0.0023709,8.5752e-007,4.847e-008 and I would like to import it into Mathematica and then have each column separated into a list so I can do some math on the selected column. I know I can import the data with: Import["data.csv"] then I can separate the columns with this: StringSplit[data[...

Rails - number of rows in a file

Hey. How can I get a total number of rows in a file (do not want to do it with loop). I'm reading CSV file. Example 1 CSV.open('clients.csv', 'r') Example 2 FasterCSV.foreach('clients.csv') Thx. ...

want to add url links to .csv datafeed using python

Hi all ive looked through the current related questions but have not managed to find anything similar to my needs. Im in the process of creating a affiliate store using zencart - now one of the issues is that zencart is not designed for redirects and affiliate stores but it can be done. I will be changing the store so it acts like a...

fastest way convert tab-delimited file to csv in linux

I have a tab-delimited file that has over 200 million lines. What's the fastest way in linux to convert this to a csv file? This file does have multiple lines of header information which I'll need to strip out down the road, but the number of lines of header is known. I have seen suggestions for sed and gawk, but I wonder if there is ...

Convert dta file to CSV

Is there a way to convert a dta file to a CSV? I don't have a version of Stata so I can't do something like save as CSV file. ...

Is there any simple way to convert .xls file to .csv file? (Excel)

Hi Is there any simple way to convert .xls file to .csv file ? (Excel) in C# code ? i mean to take an existing .xls file and convert hem to .csv file Thanks in advance ...

How to get database table header information into an CSV File.

I am trying to connect to the database and get current state of a table and update that information into csv file, with below mentioned piece of code, am able to get data information into csv file but am not able to get header information from database table into csv file. So my questions is How can I get Database Table Header informat...

Function returns CSV File: How to go about checking it ?

I am doing something like: $outputFile = getCurrentDBSnapshot($data); where $data is the resource stream that am passing in, basically from command prompt am passing an file and am opening it using fopen for writing with 'w+' permissions, now getCurrentDBSnapshot would get the current state of a table and would update the $data csv fi...

How to serve a View as CSV in ASP.NET Web Forms

I have a MS SQL view that I want to make available as a CSV download in my ASPNET Web Forms app. I am using Entity Framework for other views and tables in the project. What's the best way to enable this download? I could add a LinkButton whose click handler iterates over the view, writes its CSV form to the disk, and then serves that fi...

how do i load a csv file in rails from a migrate usiing load data local infile ?

Hi All, I have my csv file in my public folder, and i'm trying to load it from a migration, but I get a file not found error using this script : ActiveRecord::Base.connection.execute( "load data local infile '#{RAILS_ROOT}/public/muds_variables.csv' into table muds_variables " + "fields terminated by ',' " + "lines terminated by ...