• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Remove Email Addresses From a Formatted Excel File

New Here ,
Feb 29, 2008 Feb 29, 2008

Copy link to clipboard

Copied

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?
TOPICS
Advanced techniques

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 29, 2008 Feb 29, 2008

Copy link to clipboard

Copied

jqcf wrote:
>
> 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.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Feb 29, 2008 Feb 29, 2008

Copy link to clipboard

Copied

LATEST
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-And-Write-Excel-Files....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation