Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / February 2008



Tip: Looking for answers? Try searching our database.

Remove Email Addresses From a Formatted Excel File

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jqcf - 29 Feb 2008 19:09 GMT
I have an excel File that has some formatting in it that I would like to
preserve (some cells have background color, etc).   I'd like to remove a list
of email addresses from this file.  My first thought is to use cffile with
action read, use the following in a cfloop: replace(emailAddressToDelete,
excelFileVarCreatedFromCffileRead) and then save it back to excel format with
cffile using action write.  I tried this and the Excel file would not open.  
The error was:

test.xls cannot be accessed.  The file may be read-only, or you may be trying
to access a read-only location.  Or, the server the document is stored on may
not be responding.

I'm guessing something went wrong in the process of reading and writing the
files contents and it's not as simple as I want to make it.  Anyone have
something to tell me that might help me remove email addresses from a formatted
Excel spreadsheet?
Ian Skinner - 29 Feb 2008 19:31 GMT
>  I'm guessing something went wrong in the process of reading and writing the
> files contents and it's not as simple as I want to make it.  Anyone have
> something to tell me that might help me remove email addresses from a formatted
> Excel spreadsheet?

Yup, .xls is a proprietary encrypted file format and <cffile.... is not
going to be able to successfully read and modify it's content.  You can
copy it or move it, but not modify it with <cffile...>

If the file format was a plain text such as .txt or .csv you could do
what you are thinking about, but then you would probably not have the
proprietary excel formating in the file.

I've heard about the POI library that allows some native Excel access
and such, but I am not knowledgeable in its ins and outs.
JR "Bob" Dobbs - 29 Feb 2008 19:44 GMT
CFFILE is primarily used for text files, take a look at Apache POI or  another
Java based Excel utility.
http://poi.apache.org/hssf/index.html

http://www.bennadel.com/blog/474-ColdFusion-Component-Wrapper-For-POI-To-Read-An
d-Write-Excel-Files.htm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.