csv

How do I efficiently parse a CSV file in Perl?

I'm working on a project that involves parsing a large csv formatted file in Perl and am looking to make things more efficient. My approach has been to split() the file by lines first, and then split() each line again by commas to get the fields. But this suboptimal since at least two passes on the data are required. (once to split by l...

Problem opening a csv file through asp on ie8?

Hi, From my asp application, i am trying to open a csv file onto ie8. The same code is working fine on ie6 although. Below is the code: Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile strFilePath ContentType = "application/msexcel" Response.AddHead...

How to find if the file is a CSV file?

I have a scenario wherein the user uploads a file to the system. The only file that the system understands in a CSV, but the user can upload any type of file eg: jpeg, doc, html. I need to throw an exception if the user uploads anything other than CSV file. Can anybody let me know how can I find if the uploaded file is a CSV file or no...

Convert CSV file to XML

I need to Convert a CSV into an XML document. The examples I have seen so far, all show how to do this with a fixed number of columns in the CSV. I have this so far, using LINQ: String[] File = File.ReadAllLines(@"C:\text.csv"); String xml = ""; XElement top = new XElement("TopElement", from items in File ...

Generate table schema inspecting Excel(CSV) and import data

How would I go around creating a MYSQL table schema inspecting an Excel(or CSV) file. Are there any ready Python libraries for the task? Column headers would be sanitized to column names. Datatype would be estimated based on the contents of the spreadsheet column. When done, data would be loaded to the table. I have an Excel file of ~2...

Query a Lookup Table in Excel or Access

I've got a mental block about what I'm sure is a common scenario: I have some data in a csv file that I need to do some very basic reporting from. The data is essentially a table with Resources as column headings and People as row headings, the rest of the table consists of Y/N flag, "Y" if the person has access to the resource, "N" if...

How can I optimize my PowerShell - LDAP Query?

Hey guys, this one is out there for the PS gurus. I've created a script that reads from a CSV (or other dataset, but not posting that side) and creates users in my AD environment. Basically, whatever dataset is passed into the script will be processed, and then a user will be created if they do not exist. If the user exists in the AD al...

What are MACROs in CSV or XLS files ?

What are Macros in CSV or XLS files ? How to enable or disable them ? ...

SQL Server Compact 3.5: Process/import CSV data

I have a CSV file which I wish to manipulate using SQL Server Compact (CE) 3.5 How can I bulk insert the data into a temporary table? ...

iphone, write csv file in sandbox

Hi, i must write (at start of app) and delete is content (at the end of app) a csv in my sandbox file with a stream of data. For your experience, what's the best way to do this? edit: i'm trying with this: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = ...

Create an utf-8 csv file in Python.

I can't create an utf-8 csv file in Python. I'm trying to read it's docs, and in the examples section, it says: For all other encodings the following UnicodeReader and UnicodeWriter classes can be used. They take an additional encoding parameter in their constructor and make sure that the data passes the real reader or wri...

How do I convert this list of dictionaries to a csv file? [Python]

I have a list of dictionaries that looks something like this: toCSV = [{'name':'bob','age':25,'weight':200},{'name':'jim','age':31,'weight':180}] What should I do to convert this to a csv file that looks something like this: name,age,weight bob,25,200 jim,31,180 ...

Is there a popular and/or robust PHP CSV library?

I've just been tasked to start processing some CSV files in PHP. I have no idea what's out there. I thought I'd ask StackOverflow to help augment my search. What libraries are out there, what do people use most, and why? Thanks a million! ...

New lines in tab delimited or comma delimtted output

I am looking for some best practices as far as handling csv and tab delimited files. For CSV files I am already doing some formatting if a value contains a comma or double quote but what if the value contains a new line character? Should I leave the new line intact and encase the value in double quotes + escape any double quotes within ...

Populate a registration form with Tab Delimited Data

I have a Tab Delimited Data lets say Name Address DOB EmailID copied to clipboard, now I need to paste this data on some online html forms which contains these fields,but whenever I am trying to do so its pasting all the contents in selected text box, where as if I try the same in excel its recognizing the tabs and placing each filed pro...

Import comma-delimited text to xcode plist

I have a very long (well, 4000+ items) in a csv file which I would like to put into a plist in xcode for my program to use. Does anyone have any idea how to do this, just in xcode & not using parsing code? Many thanks. ...

How to export subtables to csv format in Piwik

Hi every one, Current implementation of Piwik exports all 1st level tables to csv format.I want to export subTables also with parent table.Is there any way to do this.Please let me know.. ...

Importing csv, tab delimited and excel files into c#

I'm developing an Excel import routine which is using OLEDB to read the file. Can I just reuse my code to do the same thing for csv and tab delimited files by just changing the connection string, and what would the strings be? ...

Method for guessing type of data represented currently represented as strings in python

I'm currently parsing CSV tables and need to discover the "data types" of the columns. I don't know the exact format of the values. Obviously, everything that the CSV parser outputs is a string. The data types I am currently interested in are: integer floating point date boolean string My current thoughts are to test a sample of ...

how do i convert .rpt files to csv

I inherited an old vb6 app that handles .rpt files. i need to extract the data in the files into a csv format so i can import into sql server. Please help. thanks ...