csv

In Perl, how can I get the fields in this CSV string into an array without spaces?

Hi, if I have a string, say: my $string = "A, B,C, D , E "; How can I put this into an array in Perl without the leading and trailing spaces? So what I want is only a single letter in each array element. What I currently do is this: my @groups = split /,\s*/, $string; But this is obviously not enough, as the trailing spaces are st...

How to separate CSV fields in Excel to be in separate boxes

For example, I have the following: fname;lname;email ...and it's all in one box. I would like it to be separated in different boxes, like: fname lname email How can I do this? ...

Interactive heat map in Flex

Hi All! I’m at a very basic level with Flex and with programming in general. I am working on a project where I have data in an Excel (.csv) format, it’s a large Excel plot/matrix where each cell has a temperature number. I want to import this matrix into Flex somehow, or parse the data in Flex, so that this matrix turns into an interact...

Best approach to parse text files that contain multiple types of delimiters?

I need to parse some text files that have different types of delimiters (tildes, spaces, commas, pipes, caret characters). There is also a different order of elements depending on what the delimiter is, e.g: comma: A, B, C, D, E caret: B, C, A, E, D tilde: C, A, B, D, E The delimiter is the same within the file but different from one...

SPROC to delete multiple rows with comma-delimited input?

I've created a sproc to delete multiple records by accepting a comma-delimited list of ID's as varchar, and using IN to attempt the deletion - doesn't work: ALTER PROCEDURE [dbo].[sp_DeleteItemsFromItemCategories] @UserID bigint, @ItemsList varchar(8000) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interferi...

marking duplicates in a csv file

Hello, I'm stumped with a problem illustrated in the sample below: "ID","NAME","PHONE","REF","DISCARD" 1,"JOHN",12345,, 2,"PETER",6232,, 3,"JON",12345,, 4,"PETERSON",6232,, 5,"ALEX",7854,, 6,"JON",12345,, I want to detect duplicates in column "PHONE", and mark the subsequent duplicates using the column "REF", with a value pointing to ...

How to create a temporary table in MySQL to output table data as a CSV file?

I've got a script for creating a CSV file from a database table, which works fine except that it outputs all the data in the table, and I need it to output data only for the current logged in user. The app I'm developing is for users to be able to store lists of books they've read, want to read, etc., and I want to be able to allow them ...

Convert JSON to CSV or unstructured text

How might you take JSON output (e.g., from http://www.kinggary.com/tools/todoist-export.php) and strip the names to yield just the values from each pair, as CSV or human-friendly text? Want a more readable, human-editable backup of my friend's data on todoist.com ...

Parsing CSV data in python

I am getting this sort of CSV data while making Http request to the CSV file. Very malformed string. response = '"Subject";"Start Date";"Start Time";"End Date";"End Time";"All day event";"Description""Play football";"16/11/2009";"10:00 PM";"16/11/2009";"11:00 PM";"false";"""Watch 2012";"20/11/2009";"07:00 PM";"20/11/2009";"08:00 PM";"f...

How can add values in each row and column and print at the end in Perl?

Below is the sample csv file date,type1,type2,..... 2009-07-01,n1,n2,..... 2009-07-02,n21,n22,.... and so on... I want to add the values in each row and each column and print at the end and bottom of each line. i.e. date,type1,type2 2009-07-01,n1,n2,.....row_total1 2009-07-02,n21,n22,....row_total2 Total,col_total1,col_total1,......t...

Excel VBA - Recursively list files and output to csv

Hi guys, I've got a problem with my VBA (you guessed it). I took code from this post: vbaexpress.com/kb/getarticle.php?kb_id=405 and added in: wilmott.com/messageview.cfm?catid=10&threadid=40372 Basically, first code would output to a worksheet, but as I theoretically could breach the 65k rows limit, I'd like to output to a csv inste...

When creating a CSV file, do you need to escape certain characters?

I am generating a CSV file from Ruby. The problem is a column string will contain double quotes, single quotes. How can I escape these things? "Mary had a little so called \"lamb\"","34","none" "something is not \"right\"","23","none" Each column is enclosed in double quotes followed by comma (and no space), and written into a file. ...

python csv headers

I have set of csv headers that i am trying to match with uploads, it's not really working. Not all headers are required, just have to match what's in file reader = csv.DictReader(open(PathFile)) headers = reader.fieldnames for header in sorted(set(headers)): if (header == 'ip') or (header == 'IP'): pr...

PHP - Sanitise a comma seperated string

What would be the most efficient way to clean a user input that is a comma seperated string made entirely on numbers - e.g 2,40,23,11,55 I use this function on a lot of my inputs function clean($input){ $input=mysql_real_escape_string(htmlentities($input,ENT_QUOTES)); return $input; } And on simple integers I do: if (!filter_v...

SQLite - SELECT over multiple entries of the same data/column

I am a bit new to SQLite, and I am having a slight dilemma about my database design. I'll explain. Suppose you and your friends use a number of different nicknames on the Internet (can be more than one per person). What we have here is an ID of the person and a list of all nicknames that this person uses. This is a single entry in a larg...

Excel: Default to TEXT rather than GENERAL when opening a .csv file

Is is possible to change the default data type Excel uses when opening a .csv file? I would like Excel to default to TEXT rather than General for the Column Data Format when reading a .csv file. I would like to be able to open a .csv without having leading 0's removed from my data. Currently I use the Import External Data wizard when re...

Styling rows in table that uses CSV data through PHP

Hi, I've been working on this simple code that puts a CSV file into a nice table. But because the data is imported, styling ODD rows is a pretty hard thing to do. All I need would be a method to address certain rows, so I can make a "zebra" like background, and put specific data in another text style. Does aynone have an idea? thanks ...

Commercial .NET CSV Parser/Library

Hi Our company has pretty much banned us from using open-source libraries in our commercial products due to licensing issues. We are currently looking for a commercial .NET library that can read and parse CSV files - does anyone have any ideas ? As far as functionality goes, I really need to be able to read a CSV file into a strongly ...

Problem with rows and columns from a CSV

Hi, I'm having a major problem with writing values into a new CSV file. I receive a csv file from which I parse all of the values. This works fine, I've brought this up and put it into a datagridview. The first thing that we want to do with this file is to re-arrange it. As it stands, there are two sets of headers: one along the top, a...

JSP page without HTML code for exporting data to Excel Sheet

Hi friends, I am facing a problem in exporting my data to excel sheet, this is because of some code which other developers in my team made. So the main problem is to export the data to Excel or .cvs using JSP page but without using any HTML code. Any suggestion would also help me to explore in my developing arena. Thanks for your efforts...