csv

mysql import csv problem

OK, I have just been reading and trying for the last hour to import a csv file from access into mysql, but I can not get it to do it correctly, no matter what I try. My table is like so: +-----------------+------------- | Field | Type +-----------------+------------- | ARTICLE_NO | varchar(20) | ARTICLE_NAME | varchar...

How do you import CSV files with "improper" file names?

Ok, I am importing and parsing csv files in a C# app. I started out doing a simple ReadLine() and splitting on commas but it turns out some of the text fields have commas in them. So I started to roll my own splitting function. Fortunately, it was only a few minutes before the "Hey stupid, someone's probably already done this?" light c...

converting access datetime type to mysql type

Hello, I am trying to convert an access datetime field to a mysdl format, using the following string: select str_to_date('04/03/1974 12:21:22', '%Y %m %d %T'); While I do not get an error, I do not get the expected result, instead I get this: +---------------------------------------------------+ | str_to_date('04/03/1974 12:21:22', ...

How can I join lines in a CSV file when one of the fields has a newline?

If I have a comma separated file like the following: foo,bar,n ,a,bc,d one,two,three ,a,bc,d And I want to join the \n, to produce this: foo,bar,n,a,bc,d one,two,three,a,bc,d What is the regex trick? I thought that an if (/\n,/) would catch this. Also, will I need to do anything special for a UTF-8 encoded file? Finally, a sol...

SSIS/CSV Architecture question

Hi All, I'm building a series of SSIS packages which will be designed to do the following: 1.) import a few thousand rows from a CSV file into a series of SQL 2005 tables 2.) export a few thousand rows into a series of CSV files I've a few concerns before I dive in: a.) Before I import my csv files, I first want to check that the fil...

automatically convert access db

Hello, I have an access database, with a query made. I need to automate it so that each night this query can run and export to a tab delimited csv file. It is not possible to export a query to a csv file from within access. My question is, are there any tools that can select certain tables, or perform an sql query on an mdb file, and ex...

Different results exporting to CSV or Excel

I have a simple report that I want to export to a CSV file. There is only the detail line that is grouped by one field, no group header, and a group footer for totals. The problem is when I export to CSV format, the total row for a group is listed in front of every record? If I export to Excel and then save as a CSV file, the total ro...

CSV for Excel, Including Both Leading Zeros and Commas

I want to generate a CSV file for user to use Excel to open it. If I want to escape the comma in values, I can write it as "640,480". If I want to keep the leading zeros, I can use ="001234". But if I want to keep both comma and leading zeros in the value, writing as ="001,002" will be splitted as two columns. It seems no solution to...

problem with PHP reading CSV files

I'm trying to read data from a.csv file to ouput it on a webpage as text. It's the first time I'm doing this and I've run into a nasty little problem. My .csv file(which gets openened by Excel by default), has multiple rows and I read the entire thing as one long string. like this: $contents = file_get_contents("files/data.csv"); I...

parse csv file using gawk

How do you parse a csv file using gawk? Simply setting FS="," is not enough, as a quoted field with a comma inside will be treated as multiple fields. Example using FS="," which does not work: file contents: one,two,"three, four",five "six, seven",eight,"nine" gawk script: BEGIN { FS="," } { for (i=1; i<=NF; i++) printf "field #...

CSV Parsing

I am trying to use C# to parse CSV. I used regular expressions to find "," and read string if my header counts were equal to my match count. Now this will not work if I have a value like: "a",""b","x","y"","c" then my output is: 'a' '"b' 'x' 'y"' 'c' but what I want is: 'a' '"b","x","y"' 'c' Is there any regex or any other logi...

PST to CSV File Conversion

Does anyone know of a good tool that converts .pst to .csv files through command line? ...

What is best way to read CSV data?

Hi Guys, I am using C# and trying to read a CSV by using this connection string; Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\rajesh.yadava\Desktop\orcad;Extended Properties="Text;HDR=YES;IMEX=1;FMT=Delimited" This works for tab delimited data. I want connection string which should for tab delimited as well...

How to paste CSV data to Windows Clipboard with C#

What I'm trying to accomplish My app generates some tabular data I want the user to be able to launch Excel and click "paste" to place the data as cells in Excel Windows accepts a format called "CommaSeparatedValue" that is used with it's APIs so this seems possible Putting raw text on the clipboard works, but trying to use this format...

Curly quotation marks vs Square quotation marks, what gives?

An interesting problem that no doubt someone here has come across before. I'm reading a CSV file that contains some values wrapped in quotes, I came across a problem today were my app couldn't read the file as the value was wrapped in cury quotation marks and not square quotation marks. Is this an encoding problem? I simply replaced t...

RoR: FasterCSV to hash

I'm really struggling with grasping how to effectively use FasterCSV to accomplish what I want. I have a CSV file; say: ID,day,site test,tuesday,cnn.com bozo,friday,fark.com god,monday,xkcd.com test,saturday,whatever.com I what to go through this file and end up with a hash that has a counter for how many times the first column occur...

Export data from SQL2005 stored procedure to CSV

Hello, I want to find a way to allow our reporting guy to export data returned from a stored procedure into a CSV file. The procedure will need a (date) parameter passing to it. Is there a data export wizard I can get him to use, or some other user friendly way in SQL2005 that he can generate the CSV (after providing some parameters)....

html getting garbled from php

Hello, I have a mysql database which as one of the fields contains a html description. This description is not in my control, and is obtained and inserted automatically. An example of one of these descriptions is here: http://www.nomorepasting.com/getpaste.php?pasteid=22492 The data is originally exported from an access database, and ...

Skipping a column in FileHelper

Using the FileHelper library for .Net, can I somehow skip a number of columns from the source file? According to docs and samples, I have to add fields for all columns. Alas, I have an excel sheet with 216 columns to import, from which as few as 13 are necessary. ...

How to output MySQL query results in csv format?

Is there an easy way to run a MySQL query from the linux command line and output the results in csv format? Here's what I'm doing now: mysql -u uid -ppwd -D dbname << EOQ | sed -e 's/ /,/g' | tee list.csv select id, concat("\"",name,"\"") as name from students EOQ It gets messy when there are a lot of columns that need to be...