是的,试图找到一种方法来避免每次通过都打开电子表格,这修复了它......现在快得多......
<body bgcolor="#0033FF">
<cfset filenm = "SitesTest.xlsx">
<cfset thisPath = GetDirectoryFromPath(ExpandPath("*.*"))>
<cfset uploaddirectory = "#thisPath#Uploads\">
<cfset uploadfile = "#uploaddirectory##filenm#">
<cfset floc = "#uploadfile#">
<!--- --->
<!--- --->
<!--- --->
<!--- Read Spreadsheet Count number of Rows --->
<cfspreadsheet action="read"
src="#floc#"
headerrow="1"
query="SiteSS"
>
<cfset Records = "#SiteSS.RecordCount#">
<!--- Get Header Row from Row 1 --->
<cfspreadsheet action="read"
format="csv"
name="ColumnHeaderRow"
src="#floc#"
headerrow="1"
rows="1"
columns="1-7,15,16,22,23">
<cfset Headeritems = ListLen(ColumnHeaderRow)>
<cfset csvallVar = "">
<cfset CSVSiteData = "">
<cfspreadsheet
action = "read"
src="#floc#"
query="siteinfo"
rows="1-#Records#"
columns="1-7,15,16,22,23" >
<cfset rowcount = 2>
<cfloop Query="siteinfo" startrow="2" endrow="#Records#" >
<cfset EntryType = "SiteInfo">
<!--- Create Line Item Lists--->
<cfset CSVSiteData = "#siteinfo.col_1#, #siteinfo.col_2#, #siteinfo.col_3#, #siteinfo.col_4#, #siteinfo.col_5#, #siteinfo.col_6#, #siteinfo.col_7#, #siteinfo.col_8#, #siteinfo.col_9#, #siteinfo.col_10#, #siteinfo.col_11#">
<cfset CSVSiteDataCheck = "#siteinfo.col_1#, #siteinfo.col_2#, #siteinfo.col_3#, #siteinfo.col_4#, #siteinfo.col_5#, #siteinfo.col_6#, #siteinfo.col_7#, #siteinfo.col_8#, #siteinfo.col_9#, #siteinfo.col_10#, #siteinfo.col_11#">
<cfset Manager = #siteinfo.col_1#>
<cfset Market = #siteinfo.col_2#>
<cfset FALocationCode = #siteinfo.col_3#>
<cfset USID = #siteinfo.col_4#>
<cfset CommonID = #siteinfo.col_5#>
<cfset EquipmentName = #siteinfo.col_6#>
<cfset EquipmentType = #siteinfo.col_7#>
<cfset PrimaryTech = #siteinfo.col_8#>
<cfset Address = #siteinfo.col_9#>
<cfset LatitudeDecimal = #siteinfo.col_10#>
<cfset LongitudeDecimal = #siteinfo.col_11#>
<!------>
<cfquery name="CheckDup" datasource="TechData">
select CSVSiteData From sitelist2
where CSVSiteData = '#CSVSiteDataCheck#'
</cfquery>
<cfif CheckDup.recordcount lt 1>
<cfquery name="Insertsite" datasource="TechData">
INSERT INTO sitelist2 (
EntryType,
CSVSiteData,
Manager,
Market,
FALocationCode,
USID,
CommonID,
EquipmentName,
EquipmentType,
PrimaryTech,
Address,
LatitudeDecimal,
LongitudeDecimal
)
VALUES (
'#EntryType#',
'#CSVSiteData#',
'#Manager#',
'#Market#',
'#FALocationCode#',
'#USID#',
'#CommonID#',
'#EquipmentName#',
'#EquipmentType#',
'#PrimaryTech#',
'#Address#',
#LatitudeDecimal#,
#LongitudeDecimal#
)
</cfquery>
"Record <cfoutput>#rowcount#</cfoutput> added"<br />
<cfelse>
"Record <cfoutput>#rowcount#</cfoutput> not added"<br />
</cfif>
<cfset rowcount = rowcount + 1>
</cfloop>
</body>