Ben

If I understand correctly you want to delete the column in the excel
worksheet before you change it to a csv file.
Below code does this thru a com object.
Haven't played around with it much but this will delete a column from an
excel worksheet.


<!----connect/create connections to an excel object---------->
<CFTRY>
        <CFOBJECT action="CONNECT" CLASS="Excel.Application" Name="objExcel"
Type="COM">

        <CFCATCH>
                <CFOBJECT action="CREATE" CLASS="Excel.Application"
Name="objExcel" type="COM">             
        </CFCATCH>
</CFTRY>



<CFSCRIPT>
        objExcel.Visible = False;
        objExcel.DisplayAlerts = False;
        objBooks = objExcel.Workbooks;
        objBook = objBooks.Open("C:\yourdir\yourfile.XLS");

        objBook.Activate();
        objSheets = objBook.Worksheets;
        objSheet = objSheets.Item("wptotals");
        objRange = objSheet.Range("A:A");
        objRange.delete();

        objBook.save("C:\yourdir\yourfile.XLS");
        objBooks.close();
</CFSCRIPT>






-----Original Message-----
From: Ben Densmore [mailto:[EMAIL PROTECTED]
Sent: Monday, September 22, 2003 1:54 PM
To: CF-Talk
Subject: RE: Stripping out columns in Excel


Yeah Tony,
 I was trying to come up with a way to do it in my code rather than
manually deleting the columns I don't need in Excel. I all ready went
ahead and deleted the columns because it was easier but I'd still like
to find a way to do it in my code.

Thanks,
Ben

-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 22, 2003 4:14 PM
To: CF-Talk
Subject: RE: Stripping out columns in Excel

besides highlighting the column in excel and deleting it? 

-----Original Message-----
From: Ben Densmore [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 22, 2003 3:44 PM
To: CF-Talk
Subject: Stripping out columns in Excel

Hey everyone,

 I have an excel file that has about 10 columns in it but I only need 4.
I converted the excel file to a csv file but now am stuck on how to get
only
the columns I need. Is there a good solution for doing this?

 

Thanks,

Ben





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:138011
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to