Question

Deleting the template sheets after writing Excel file with a template file


Hello everybody,

I want to create an Excel file with the FeatureWriter. To get the output well formatted I created a new file before that all as a template file. Well, the FeatureWriter does something I don't want to have. It creates a copy of the template file and creates a new sheet in this copy with the output.. This sheet is exactly that what I want to have but the additional sheets of the copy are disturbing. Is it possible to remove the sheets of the template and just keep the sheet which contains the output?

Best regards,

Felix


6 replies

Badge +2

Hi @felixderglueckl,

Why could you create a second writer to create the sheet and keep your template as it is? Perhaps I do not have a celar picture of what you do without the workspace in hand.

Hi @gisinnovationsb

thanks for your answer. If I understand you right I still tried something like that. I tried to create a FeatureReader after the FeatureWriter that reads the written file into the workspace and I created a second FeatureWriter which just writes the sheet I want to have in a new file. But that does not really work because the format of the Excel file which was created by the template file in the first writer is not taken here.

I guess it does not really makes sense to send you a picture of the workspace. The situation I have is really clear. I have an Input feature and a FeatureWriter which creates an Excel file out of the Input table.

I can just show you the transformer parameters of the FeatureWriter (just ignore the red colour of the Input field of 'Template File').

Badge +2

Hi @felixderglueckl,

Why could you create a second writer to create the sheet and keep your template as it is? Perhaps I do not have a celar picture of what you do without the workspace in hand.

@felixderglueckl,

 

please try setting "drop existing sheet to yes." in the MS Excel properties dialog.

 

Userlevel 2
Badge +17

Hi @felixderglueckl, I don't think there is a way to delete automatically unused template sheets from the resulting Excel book.

Just a few days ago, I posted a relevant idea: ExcelWorksheetRemover/Keeper Transformer

Userlevel 4
Badge +25

Just to make sure I'm clear, if the template sheet is "abc" and is used to create a new sheet ("xyz") in a new file, then sheet abc should not also exist in that new file. Correct?

I think that's a reasonable request. I see PR#65790 that looks like it is for the same (or similar) requirement. I've added a note with a link to this thread, and increased the priority a little. Hopefully it will be implemented soon.

Userlevel 2
Badge +17

Just to make sure I'm clear, if the template sheet is "abc" and is used to create a new sheet ("xyz") in a new file, then sheet abc should not also exist in that new file. Correct?

I think that's a reasonable request. I see PR#65790 that looks like it is for the same (or similar) requirement. I've added a note with a link to this thread, and increased the priority a little. Hopefully it will be implemented soon.

Other than that, there are some points to be considered. Probably I've requested these points to Support already.

 

  1. A single Excel book contains multiple sheets e.g. "sheet1", "sheet2", etc. and the destination book only requires to use "sheet1" as template, but the "sheet2" will also be copied to the destination book. It would be nice if the "sheet2" would not be copied.
  2. A single Excel book contains multiple sheets e.g. "sheet1", "sheet2", etc. and the destination book also use all of them but requires to rename them e.g. "sheet1" to "abc", "sheet2" to "xyz". The current Excel writer cannot do that, since the Template Sheet cannot be specified for individual writer feature type (sheet) separately.
  3. Multiple books e.g. "book1" and "book2" contain different sheets e.g. "sheet1" in "book1", "sheet2" in "book2", and a single destination Excel book requires to use those sheets as templates simultaneously. The current Excel writer cannot do that, since the Template File/Sheet cannot be specified for individual writer feature type (sheet) separately.
In my personal view, the priority for 1 should be higher than 2 and 3.

 

Reply