1

can I use cfspreadsheet to update/add some data within in an already existing template without losing styles in it? I got a template with some column headers and tabular styling in it with some colors n all, so can I process that file and update data into it.

Any thoughts on this line will be much appreciated.

Thanks,

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
A DEv
  • 255
  • 1
  • 19

2 Answers2

2

Just answering myself if it helps some one else...

  1. Read file template using read action and specify sheet.
  2. Use SpreadsheetSetCellValue() to update the values in the corresponding cells you needed(it wont disturb any other cells or their data).
  3. Then use write action with overwrite true and specify sheet name...that's it

and this is all works in CF10

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
A DEv
  • 255
  • 1
  • 19
1

What have you tried so far? Without posting your code, it's not possible to provide an exact answer. As for myself, I've never tried it, but it does look possible. Although it appears that it's not as straightforward a process as one would think. According to the online docs it looks like you will need to read in all of the sheets of the file, and then use the update and write options, and then rewrite the entire file.

It looks like some experimentation might be in order on your part. I'd first start by trying with reading and re-writing the entire spreadsheet with no modifications first, and then proceed from there. See what you are able to accomplish in small steps, and then build on it.

  • To update an existing file, read all sheets in the file, modify one or more sheets, and use the contents, and use the write action and Update actions (for multiple sheet files) to rewrite the entire file.
user12031119
  • 1,228
  • 4
  • 14