Forum Discussion
Office Script - Bug in .map()?
I'm not sure. It seems to have worked fine for me:
oh dang, I'm pretty sure I know why. you are trying to put it in a Table. If you are putting a formula in a table it will repeat the formula down the column. To get that formula to reference a different row you want to use the @ symbol. so you don't even need to use the .map just assign that column a formula like
=[@file_names]&"TestString"
assuming file_names is the header name of that column. If it is "file name" then you will need double [[]] like this:
=[@[file names]]&"TestString"
ok so I confirmed if putting into a TABLE that is what will happen. Here is my modified script that appears to work:
notice i did need the double [[ ]] even though the name didn't have a space in it.
and to my point that you don't even need the .map here I change the last line to directly set the formula of the 1st cell and it will autopopulate the whole column: