Using cfspreeadsheet to load data intoa database

Posted on 2011-10-13
Medium Priority
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
  • 2
LVL 52

Accepted Solution

_agx_ earned 400 total points
ID: 36963014
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 52

Expert Comment

ID: 36964595
    > VALUES ( '#FirstQueryColumn#', '#SecondQueryColumn#', ....)

Note: In your real query you should use cfqueryparam

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

850 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