Skip to main content

Hi,

I would like to add a new row containing some descriptive information from a seperate stream above header row in an excel spreadsheet.

Thanks

David McDermott

Hi @djmcdermott, a possible way is to write data records starting with a specific row using a FeatureWriter, and then write (insert) descriptive rows starting with the first row in the same sheet using another Excel writer. You can control starting row through the Start Row parameter in the Excel writer feature type. For example, assuming that the number of descriptive rows is three,

FeatureWriter (Excel Writer / Feature Type) Parameters

  • Overwrite Existing File: Yes
  • Output Field Names: Yes
  • Use Attribute Names As Column Positions: No
  • Start Position | Start Row: 4 (= 3 + 1)

Excel Writer / Feature Type Parameters

  • Overwrite Existing File: No
  • Output Field Names: No
  • Use Attribute Names As Column Positions: Yes
  • Start Position | Start Row: 1

Excel reader has a xlsx_row_id attribute.

Read the excel, increase xlsx_row_id by 1.

Create your row to be inserted on top, give it number 0 and sort.

Write to excel.


Hi @djmcdermott, a possible way is to write data records starting with a specific row using a FeatureWriter, and then write (insert) descriptive rows starting with the first row in the same sheet using another Excel writer. You can control starting row through the Start Row parameter in the Excel writer feature type. For example, assuming that the number of descriptive rows is three,

FeatureWriter (Excel Writer / Feature Type) Parameters

  • Overwrite Existing File: Yes
  • Output Field Names: Yes
  • Use Attribute Names As Column Positions: No
  • Start Position | Start Row: 4 (= 3 + 1)

Excel Writer / Feature Type Parameters

  • Overwrite Existing File: No
  • Output Field Names: No
  • Use Attribute Names As Column Positions: Yes
  • Start Position | Start Row: 1
Thanks @takashi. Shame there isn't a more elegant way in the writer itself.

 


Hi @djmcdermott, a possible way is to write data records starting with a specific row using a FeatureWriter, and then write (insert) descriptive rows starting with the first row in the same sheet using another Excel writer. You can control starting row through the Start Row parameter in the Excel writer feature type. For example, assuming that the number of descriptive rows is three,

FeatureWriter (Excel Writer / Feature Type) Parameters

  • Overwrite Existing File: Yes
  • Output Field Names: Yes
  • Use Attribute Names As Column Positions: No
  • Start Position | Start Row: 4 (= 3 + 1)

Excel Writer / Feature Type Parameters

  • Overwrite Existing File: No
  • Output Field Names: No
  • Use Attribute Names As Column Positions: Yes
  • Start Position | Start Row: 1
If you will write the header (field names row) as well as the descriptive rows, this workflow is also possible, since you can specify the row number (1-based sequential number) for each feature via the Row Number Attribute optionally. I don't know if this is more elegant...

 

 

 

 

 


Hi @djmcdermott, a possible way is to write data records starting with a specific row using a FeatureWriter, and then write (insert) descriptive rows starting with the first row in the same sheet using another Excel writer. You can control starting row through the Start Row parameter in the Excel writer feature type. For example, assuming that the number of descriptive rows is three,

FeatureWriter (Excel Writer / Feature Type) Parameters

  • Overwrite Existing File: Yes
  • Output Field Names: Yes
  • Use Attribute Names As Column Positions: No
  • Start Position | Start Row: 4 (= 3 + 1)

Excel Writer / Feature Type Parameters

  • Overwrite Existing File: No
  • Output Field Names: No
  • Use Attribute Names As Column Positions: Yes
  • Start Position | Start Row: 1

Hi @Takashi

 

 

Your answer help me a lot to solve : https://knowledge.safe.com/questions/112230/how-to-define-some-values-in-excel-header-with-att.html

 

 

Thank you

Reply