csv

RegEx for CSV validation + jQuery

Hello All, Using jQuery validation plugin but it has no CSV validation. I have made an additional validation for this but can't get the RegEx right. Here is what I have: jQuery.validator.addMethod("csv", function(value, element) { return this.optional(element) || /([\w.$]+?(,[\w.]+)+)/.test(value); }, "Must be comma separated if ent...

SQL Server Bulk insert of CSV file with inconsistent quotes

Is it possible to BULK INSERT (SQL Server) a CSV file in which the fields are only OCCASSIONALLY surrounded by quotes? Specifically, quotes only surround those fields that contain a ",". In other words, I have data that looks like this (the first row contain headers): id, company, rep, employees 729216,INGRAM MICRO INC.,"Stuart, Becky"...

Comma delimited output from SQL query

How can i put the result of a sql server query into a "comma delimited" format? ...

Easy method of exporting an html table to excel file in ASP.NET?

Have a report generated from the DB, want to add an export button so they can get the same report in a excel readable sheet of some type. The key here is ease of implementation so a CSV is fine over XLS if it's easier. ...

How do I return a CSV from a Pylons app?

I'm trying to return a CSV from an action in my webapp, and give the user a prompt to download the file or open it from a spreadsheet app. I can get the CSV to spit out onto the screen, but how do I change the type of the file so that the browser recognizes that this isn't supposed to be displayed as HTML? Can I use the csv module for th...

trouble importing csv files to mysql from vbs and access

I am using the following code, based on from previous posts and answers by Remou and Anthony Jones. Dim db: db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\baywotch.db5" Dim exportDir: exportDir = "C:\Dokumente und Einstellungen\hom\Desktop" Dim exportFile: exportFile=NewFileName(exportDir) Dim cn: Set cn = Create...

Newlines in Javascript and PHP5

Hi, I have a CSV string that is embedded within an XML document, which is necessary for a flash chart which uses XML. The problem is that the chart gets the settings from the HTML file through a javascript snippet, like so: <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("/gr/amstock.swf", "line", "100%",...

Best timestamp format for CSV/Excel?

I'm writing a CSV file. I need to write timestamps that are accurate at least to the second, and preferably to the millisecond. What's the best format for timestamps in a CSV file such that they can be parsed accurately and unambiguously by Excel with minimal user intervention? ...

importing into mysql mangled

I am trying to import a CSV file into MySQL 5.0 with the following line: LOAD DATA LOCAL INFILE 'file' INTO TABLE MYTABLE FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' My table schema is as follows CREATE TABLE AUCTIONS ( ARTICLE_NO VARCHAR(20), ARTICLE_NAME VARCHAR(100), SUBTITLE VARCHAR(20), CURREN...

Mysql: Getting Count of Comma Separated Values With Like

I decided to use favs (id's of users which marked that post as a favorite) as a comma separated list in a favs column which is also in messages table with sender,url,content etc.. But when i try to count those rows with a quey like: select count(id) from messages where favs like '%userid%' of course it gives wrong results because al...

What's the best way to customise and view Amazon Web Service Usage reports ?

Hi, does anyone know the best tools to use to view amazon web service usage reports? I have downloaded previous reports as .csv and opened in Excel. I want to be able to generate custom reports with the data however and so think XML is a better bet and to use something like Altova XMLspy with a stylesheet to generate custom reports. Is ...

.NET System.OutOfMemoryException on String.Split() of 120 MB CSV file

I am using C# to read a ~120 MB plain-text CSV file. Initially I did the parsing by reading it line-by-line, but recently determined that reading the entire file contents into memory first was multiple times faster. The parsing is already quite slow because the CSV has commas embedded inside quotes, which means I have to use a regex spli...

Is there an equivent library to Java's DisplayTag in PHP?

For a long time in the Java/JSP world I used to use the Display Tag library to generate a table that would allow you to sort a table, and export the table as a CSV file. Is there anything like this in a PHP library that I could use? ...

Why does Spreadsheet::XLSX::Utility2007's xls2csv round off to two decimal places?

I am writing a Perl/Tk script which displays Excel worksheets using the ss2tk example script from the Spreadsheet::Read module. It does not round off two decimal places but the function from Spreadsheet::XLSX::Utility2007 does round off to two decimal places. Why? I'm trying to use that second function as a feature of my program to offer...

How to split a comma separated String while ignoring escaped commas?

I need to write a extended version of the StringUtils.commaDelimitedListToStringArray function which gets an additional parameter: the escape char. so calling my: commaDelimitedListToStringArray("test,test\\,test\\,test,test", "\\") should return: ["test", "test,test,test", "test"] My current attempt is to use String.split() to s...

Generating fields containing newline with Ruby CSV::Writer

I want to make CSV::Writer generate a line break within a quoted string: A,B,"Line Line",C So that the row would display in Excel as: A,B,Line,C Line Is it possible to prevent CSV:Writer from stripping out newlines? If not, would switching to FasterCSV solve this problem? ...

Save csv as attachment file a PHP+Apache setup not working

I have a interesting problem that I think is server related. I want CSV data to be saved as a CSV file when a user clicks a button. It works fine on my development server, but on the production it just echo's the content to the page. My guess is that it must be a server issue, but I'm really not sure what it could be. Can GZIP affect...

Reading a CSV file into Java as a DB table

I've found numerous posts about reading CSV with Java and the APIs they were pointing at all had a line-oriented approach when it came to reading a CSV file. Something like "while you get a line, get the values of every column". I'd appreciate a higher-level API, like in Perl where DBI allows you to use SQL on CSV like if it where a DB ...

Combining 2 .csv files by common column.

So I have two .csv files where the first line in file 1 is: MPID,Title,Description,Model,Category ID,Category Description,Subcategory ID,Subcategory Description,Manufacturer ID,Manufacturer Description,URL,Manufacturer (Brand) URL,Image URL,AR Price,Price,Ship Price,Stock,Condition The first line from file 2: Regular Price,Sale Price...

MySql : Select statement using IN operator

Hi, I have a table with several fields and one field having 3 Comma Separated Values Column 1 Column 2 1 1,2,3 2 2,3,4 3 6,7,8 Now i want to run an SQL query which fetches me the rows which have the value i send as an input. Like in the above example, if i send a value 2 as an input to the function...