Pasting Variables into Excel from Web Application

excel
activities

#1

Hi All,

In the below picture, I assigned “AmountPosted” to an excel row called “Amount Posted” and “ConfirmationNumber” to a row called “Confirmation Number”.

image

In the “Excel Application Scope”, I tried using “Write Range” to display these variables but with little success.

In the below image, I am able to have my variable “CFR_Amount_From_MM” post when I assign a specific cell (G2), but when I try to have it post to the range “ConfirmationNumber” row, the excel file is comes back blank (please see picture below).

I figured since I assigned “ConfirmatioNumber” to the row “Confirmation”, it would post to that cell range…

image


#2

Did you try to writeline “ConfirmatioNumber” variable value?

It should be something like :

int rowIndex = dt.Rows.IndexOf(row);

ConfirmatioNumber= “G”+ (rowIndex+2) (for Add header Checked in Read Range)

ConfirmatioNumber= “G”+ (rowIndex+1) (for Add header unchecked in Read Range)


#3

Hi @vvaidya,

Thanks for the response. At this point I am looking to try anything, this unfortunately is not working for me.

I am unclear why my original bot is not populating into the range “Confirmation”, since I assigned it to “Confirmation” row in Excel…


#4

Try to writeline / messagebox ConfirmatioNumber and check the output.

ConfirmatioNumber = row(“Something”) gives the row value not the cell name.

This is one way to get your excel cell name from DataTable indexes , may look a bit complicated.

CellName.xaml (8.1 KB)


#5

@vvaidya

I am unable to open that project due to firewall restrictions on my computer :frowning:

Also, sorry but I am not following. In my example, I get that “ConfirmatioNumber” is my row, that is why I have it listed as my range in the “Write Cell” function. The value I am trying to display is variable “CRF_Num_From_MM”, and that works fine when I change the range from “ConfirmationNumber” to a specific cell (say cell “H2”).

image

The message box for “ConfirmationNumber” comes up blank, which I believe it should because it is a row and not a value.

image


#6

Don’t worry I’m bad at explaining. I was saying this is not the way to get the Range and you cannot get the Range from DataTable

image

As i said above you can try below ways:

int rowIndex = dt.Rows.IndexOf(row);

ConfirmatioNumber= “G”+ (rowIndex+2).ToString (for Add header Checked in Read Range)

ConfirmatioNumber= “G”+ (rowIndex+1).ToString (for Add header unchecked in Read Range)

Or

CellName.xaml (8.1 KB)


#7

@vvaidya

Hi, thanks but I am unable to do that either…I must be missing something from what you are explaining.


#8

Please assign the value to rowIndex variable inside foreach loop as the rowIndex is not fixed.


#9

Thanks for all your help! Just got it to work with help from this forum…


#10

Awesome… @vvaidya did all the job here… thanks pal…


#11

thanks @vvaidya!!!