I like jExcel. You could try this simple script with jExcel(instantiated
with javaLoader):
<!--- path to Excel sheet --->
<cfset filepath = "C:\Inetpub\wwwroot2\tryExcel_CF.xls">
<cfscript>
wfile = createObject("java","java.io.File").init(filepath);
workbookPai = server.javaLoader.create("jxl.Workbook");
wworkbook = server.javaLoader.create("jxl.write.WritableWorkbook");
wworkbook = workbookPai.getWorkbook(wfile);
sheetPai = server.javaLoader.create("jxl.write.WritableSheet");
//get sheet named cf_xl_integration - change to the name in your
workbook
sheet = wworkbook.getSheet("cf_xl_integration");
</cfscript>
<cfset rowslen = sheet.getRows()>
<cfset columnslen = sheet.getColumns()>
<cfoutput>
<cfloop from="0" to="#columnslen-1#" index="c">
#sheet.getCell(javacast('int',c),0).getContents()#
<br />
</cfloop>
</cfoutput>
Will need to download jExcel.jar and include in your directory for this
script.
Cheers
Marco Antonio
On Wed, Feb 13, 2008 at 10:54 PM, Jaime Metcher <
[EMAIL PROTECTED]> wrote:
> Brian,
>
> I would also recommend POI with Ben Nadel's POIUtility, but if you want to
> stick with a DSN, the following includes a way to unlock the datasource:
>
>
> http://cfregex.com/cfcomet/Excel/index.cfm?ArticleID=0239B2E5-5FED-11D3-B3E9
> 004033E03EF9<http://cfregex.com/cfcomet/Excel/index.cfm?ArticleID=0239B2E5-5FED-11D3-B3E9004033E03EF9>
>
> No idea if it still works in CFMX 6/7/8.
>
> Jaime Metcher
>
> > -----Original Message-----
> > From: Brian Dumbledore [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, 14 February 2008 2:05 AM
> > To: CF-Talk
> > Subject: Reading Excel..
> >
> >
> > I made the subject look easy so I can have more viewers ;) But
> > here is my problem.. After having trouble with working
> > cfx_Excel2Query ( I finally reverted to it in the end and got it
> > working), I thought why not do this:
> >
> > 1) Create a odbc dsn to a excel file
> > 2) Create a cf dsn to this odbc dsn
> > 3) User uploads his file, I copy it as the file to which the dsn
> > si specified.
> > 4) I query the file using [sheet$1] as the table, and so on.
> >
> >
> > This method works fine, however, sometimes (most of the times),
> > it appears the file being used as the dsn gets 'locked'. I cann't
> > delete, rename etc, 'next' upload of file fails to overwrite this
> > file because it is locked.
> > Basically this method is too inconsistent.
> >
> > My question is, is there anything I need to do to make sure the
> > file is 'released' after the query has run? If this one thing is
> > solved, I no longer have to use third party solutions, I can just
> > create a dsn to the file and keep overwriting the file with the
> > new file whenever.
> >
> > Any suggestions?
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299054
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4