Using cfspreeadsheet to load data intoa database

Posted on 2011-10-13
Last Modified: 2012-05-12

I've been able to get a query objct using cfspreadsheet. How then do I use that query object to insert the data from the spreadsheet into a database?


Question by:nicky2k
    LVL 51

    Accepted Solution

    Loop through the query, and insert each row one at a time.  

           <cfloop query="yourQueryName">
                  <cfquery name="addData" ....>
                         INSERT INTO TableName (Column1, Column2, .....)
                         VALUES ( '#FirstQueryColumn#', '#SecondQueryColumn#', ....)
    LVL 51

    Expert Comment

        > VALUES ( '#FirstQueryColumn#', '#SecondQueryColumn#', ....)

    Note: In your real query you should use cfqueryparam

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
    Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now