I am creating a com object in order to get the name of the worksheet in an
excel file that I am importing. When I go to read the excel file using a
dynamic datasource I am getting a error that says the file I am trying to
access is open exclusively by another user. Does anybody know how I would
release this file so I can run a query on it? Here is what I have:
<cfscript>
//create a com connection if it is not there already
try{
eobj.connect();
}
catch(Any excpt){
eobj = CreateObject('com','Excel.Application');
}
books = eobj.Workbooks;
Book = books.Open("#cffile.ServerDirectory#\#cffile.ClientFile#");
Book.Activate();
Sheets = Book.WorkSheets;
//Get the name of the first Worksheet
Sheet = Sheets.Item(Val(1));
sheetname = sheet.Name;
</cfscript>
//Then I run the query on the file
<cfquery name=whatever datasource=dynamicXLS >
SELECT *
FROM [#sheetName#$]
IN '#cffile.serverdirectory#\#cffile.clientfile#' 'EXCEL 5.0;'
</cfquery>
Any help would be greatly appreciated.
Thank You,
Bobby L. Heath
Coldfusion Developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192664
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54