Skip to main content
Question

Excel writer loosing headers when writing to named range


p.jeremie
Contributor
Forum|alt.badge.img+6

Hello,

I try to understand a weird behavior with ExcelWriter in one of my workspaces.

I achieved to reproduce the behavior in a much much simpler version of my workspace :

My destination file has 2 sheets with named ranged on each :

Behavior :

  1. When I run the workspace and the TEST/test writer is executed, everything's fine (=> NewData are written to Sheet/NamedRange and appended to TEST/test as there is no truncate of named range for this one).
  2. When I run the workspace and the TEST/test writer is NOT executed (if the link is from <Unfiltered> for example), the NewData are written to Sheet/NamedRanged but I loose the headers :

     

     

    The comments are still there, though...

 

Note : If i have two writers instead of one with two feature types, everything's fine.

 

Any idea ?

 

A zip with workspace and xlsx files :

2 replies

jovitaatsafe
Safer
Forum|alt.badge.img+11

Hi @p.jeremie,

It looks like in the Excel writer parameters, under Output Field Names,

"If no template file is used, this parameter has an effect only if the sheet or named range is being created or has been dropped or truncated prior to insertion. Otherwise, attribute names will not be added to existing worksheets or named ranges."

so you might be able to try using a template that contains the named range and checking this parameter to Yes to write out header names, or experiment with creating or truncating named ranges depending on your input data.

Hope that helps! Maybe the Community has more ideas to share as well? Always open to other ideas! (:


p.jeremie
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • October 7, 2019
jovitaatsafe wrote:

Hi @p.jeremie,

It looks like in the Excel writer parameters, under Output Field Names,

"If no template file is used, this parameter has an effect only if the sheet or named range is being created or has been dropped or truncated prior to insertion. Otherwise, attribute names will not be added to existing worksheets or named ranges."

so you might be able to try using a template that contains the named range and checking this parameter to Yes to write out header names, or experiment with creating or truncating named ranges depending on your input data.

Hope that helps! Maybe the Community has more ideas to share as well? Always open to other ideas! (:

@jovitaatsafe thanks for the answer, but I'm not sure to understand correctly.

I don't have a template in my workspace but I truncate the named range. So the parameter should be taken into account :

  • yes and the attribute names should be written in the named range
  • no and they should not be written (this is what I want, so I chose no)

But when selecting no the headers (outside of my named range !) are lost.

Second point, I don't see how I can use a template in my case because I have a tab with an history that I want to complete each time the workspace is executed, therefore I think the only way is to update the destination Excel file.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings