Reading a csv can be written in less than a hundred lines of code if:

a) you don't care about data typing, or null values
b) have column headers included in the file that match your db table
structure (or you have a reliable mapping to hash into)
c) trust the contents of the file, and its structure e.g. columns missing
etc...
d) use auto-indexing (or have external code to generate id's e.g.
CreateUUID() )

It's all the stuff that you need to assume in the above that make or break
the usefulness; it's the scope, sensitivity, accessibility, user profile
etc.. that contain the gotcha's.

Like others, I've usually had to approach this from the other direction, but
I've rolled custom one-offs that were about a simple as outlined above.

On Fri, Mar 6, 2009 at 10:17 AM, Dusty Hale <[email protected]> wrote:

> Thanks Blake I did glance at this blog post. My needs are very basic
> though. Just a simple read of the csv file and import its records into a db
> table. I'm not opposed to just writing some of my own code for this but just
> thought there might be something really quick and easy to use. This post
> seems to focus on doing the exact opposite of what I need (query to
> spreadsheet).
>
> I'm still on the hunt for a quick solution but if I don't come up with
> something super easy and quick to use, I think I may just roll my own code
> out.
>
> Thanks again,
>
> Dsuty
>
> On Fri, Mar 6, 2009 at 9:42 AM, <[email protected]> wrote:
>
>>  Dusty,
>>
>>  I have used the Java POI tool in the past.  It's easy to implement,
>> it is very fast (even at thousands of records and multiple worksheets)
>>  at reading/building an excel document.
>>
>>  I found this link on Ben Nadel's blog, he has built a nice cfc utility
>> to do the work for you, you may just have change a few mappings.
>>
>> http://www.bennadel.com/blog/469-Creating-Microsoft-Excel-Files-Using-ColdFusion-And-POI.htm
>>
>>
>> You should definitely be able to use it to read the excel file and then
>> insert into the db, as far as a custom tag to do both (file upload & read),
>> I do not have that.  If you don't specifially need the file you can use the
>> POI utility to read it on the fly and then import.
>>
>> Blake
>>
>>
>>
>> Blake Kiser
>> UPS - Business Information & Analysis
>> SCS - S530A
>> 12380 Morris Rd.
>> Alpharetta, GA  30005
>> (678) 746-4679, atlas 480-4679
>>
>>
>>  ------------------------------
>> *From:* [email protected] [mailto:[email protected]] *On Behalf Of *Dusty
>> Hale
>> *Sent:* Friday, March 06, 2009 9:31 AM
>> *To:* [email protected]
>> *Subject:* [ACFUG Discuss] excel or csv to database table
>>
>> Hi I need to implement some CF code that does this and before I write all
>> the code, I thought certainly there has got to be a custom tag or cfc that
>> already does this:
>>
>> 1. Upload excel or csv file to server.
>> 2. Import the excel sheet or csv file into a database table.
>>
>> I found an upload custom tag and now I am looking for any advise or
>> recommendation on a custom tag or cfc or piece of code that will handle the
>> import part. If anyone knows of a good solution for this, please share. Much
>> appreciation!
>>
>> Thanks,
>>
>> Dusty
>> -------------------------------------------------------------
>> To unsubscribe from this list, manage your profile @
>> http://www.acfug.org?fa=login.edituserform
>>
>> For more info, see http://www.acfug.org/mailinglists
>> Archive @ http://www.mail-archive.com/discussion%40acfug.org/
>> List hosted by FusionLink <http://www.fusionlink.com>
>> -------------------------------------------------------------
>
>
>
>
> --
> Dusty Hale
> Website: www.DustyHale.com
> Email: [email protected]
> Phone (Atlanta): 404.474.3754
>



-- 
Darin Kohles
RIA Developer

Reply via email to