Skip to main content
Question

Data to Specific COLUMN+ROW in Excel


pratap
Contributor
Forum|alt.badge.img+11
Hi All,

 

 

I want to place the data in specific column+row like D3, C5, F8...

 

 

I have mapped the column and row to attributes where I want for each record. I'm able to place to the data in required ROW with the help of "xlsx_row_id" and Writer mode to "Update Cell Contents".

 

 

Could any one please guide me how to add the column number to Excel (writer)...

 

 

I have atatched the output in inspector for reference...

 

 

 

 

I want to place value of CNT  in respective cell

 

 

Pratap

 

15 replies

owen
Forum|alt.badge.img+1
  • January 28, 2015
Hello, 

 

 

I think you just need to:
  1. expose the xlsx_col_id and xlsx_row_id as format attributes on the writer
  2. set your feature type name on the writer to be the same as your excel sheet name
  3. add your CNT attribute as a user attribute
If that doesnt work, try renaming the CNT attribute to be the same as the column name or letter eg 'B'.

 

 

Owen

pratap
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • January 29, 2015
Thank Owen,

 

 

I have done the format attribute for ROW since the option is available in writer.

 

But for column I have added xlsx_offset_col and xlsx_col_id as attributes but it didnt worked out.

 

 

Do let me if any attributes / settings, if I have missed out...

 

 

As you have suggested the second option to change the column has been done as of now as it is urgent but it is big job and more manual intervention is required in coming days since the location of the CNT value is varies from data to data.

 

 

Pratap

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015
There is no format attribute named "xlsx_col_id" as each row is a record, else i don't think this question would be posed.

 

 

You can create the attributes using an attributecreator.

 

Attrbiute name: @Value(XLSX_COL_ID) and Value: @Value(CNT)

 

 

Downside is, the attributes are now hidden and need to be exposed.

 

Someway you must make a schema to map, if you dont want to do manual exposure.

 

 

 

 

 

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015

If you write at least the result as in your picture to an excel. You can use AttributeExposer to expose those attributes by importing this written excell.

 

Write out as excell, update and choose your XLSX_ROW_ID as row id attribute.

 

result:

 

 

 

 

pratap
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • January 29, 2015
Thank Gio,

 

 

I have just placed xlsx_col_id on "trial and error".

 

 

I have made caps of XLSX_COL_ID but result is not as required.

 

 

I dont think the problem is related to schema. The problem is related to the data which is not falling at the location required in output excel file.

 

 

Pratap

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015
An excelrow is a record.

 

You must link the row_ids. 

 

 

The column attribute can then be chosen.

 

 

I see my prior pic forgot something.

 

 

But here it is.

 

 

You must expose your attributes, as i said before.

 

"XLXS_column_id" is not a format parameter.

 

 

But to get the columns like  A, B...A1,B1 etc.

 

Set "output filed names" to "NO"

 

and

 

set "Use Attribute Names As Column Positions" to "YES"

 

 

This way, You get the A,B,C,D,E  etc. columns.

 

ANd this correct result.

 

 

 

 

 

try it out.... ;)

 

 

 

 

 

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015
...and of course "Writer Mode" to "UPDATE"

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015
Updating a fille excel also works as it should:

 

 

 

 

Same workspace as above, just written to a randomly filled sheet.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015
..dang, wrong sheet...lol. soz.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 29, 2015
..i forgot tho change featuretypename on writer..so it just added a sheet to the excell.

 

here is correctly updated sheet.

 

 


pratap
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • January 30, 2015
Thanks Gio,

 

 

May be this may work but I dont have option "Use Attribute Names As Column Positions" in my writer may me this is present in higher version.

 

 

Thank you.

 

Pratap

pratap
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • January 30, 2015
It is better, if the column id is also present just like row (xlsx_row_id) rather than making all these changes :)

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 30, 2015
This is done in fme 2014sp2.

 

The excelwriter for this version has these options. Though one has to figure out oneself how it works..lol!

 

 

Yes, that would be handy. But columns in Excel dont have id's so that would be difficult.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 30, 2015
..playing around i see that the XLSXW2 writer does have a "xlsx_col_id" format attribute..

 

 

But strangely there is no way to invoke it at the writer as a format parameter

 

I'd say this writer needs rewriting..

Reply


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