Excel - How to move and write in the cell below?

excel
loop

#1

Hi,

I have a datatable in Uipath called “Fakturadetaljer” and want to go through each row for a specified column.

For example I wan’t to write down each row from “column1” into Excel by using For each row-activity. To write in Excel I use the Write Value-activity but as for now it only types the value from each row in the same cell in excel.

How do i get UIpath to move on and write in the next cell for each row in the column?

Thanks!!


#2

Hello,

two things:

  1. It writes in the same cell, because you are saying to type in “A1” and not incrementing the row number.

  2. try this one out. I used Fakturadetaljer.Rows.IndexOf(row) to read each row number in order to type the desire text. it should look like this.

here is the xaml as well, please let us know if this is works.

regards
alfred_123.zip (9.0 KB)


How to write variable value in next available cell in an excel column?
Write in excel!
Write row value
Pasting Variables into Excel from Web Application
#3

This post has been of great help to me as it got me ALMOST to my goal.

Goal: Copy a number from Excel cell starting on A2 (A1 is a header), enter it into a web search, copy data from the result, and paste it into B2 (B1 is a header). Then continue down a list with the same process and paste the data into B3, B4, B5, etc.

Problem: Everything works, but it starts pasting the data from in B10 instead of B2. So, it pastes the data acquired from A2 into B10 (instead of B2), then pastes the data acquired from A3 into B11 (instead of B3), etc.

I am using the activity Assign to set the variable MYROW=TaxLienData.Rows.IndexOf(row) as the example shows. Then I have used the activity Write Value to set the Input Range to “B1”+ MYROW. I could not get the activity Write Cell to work at all which I think is due to fact I am using an Excel Application Scope.

I also tried using a Message Box to find out the value of MYROW and it starts with 0 then 1, 2, 3, etc., so I don’t think that part is the problem.

Could someone help with a nudge in the right direction, please? Sorry I cannot upload a Zip file with my work because I am a new user.

-Chris


#4

I just got approval to upload Zip files, so I have attached my work if this helps. Thanks!
Excel Test.zip (163.2 KB)


#5

Just use “B”&myrow ,instead of “B1”+myrow.[quote=“beesheep, post:2, topic:573”]
KB)
[/quote]


#6

When I tried “B”&MYROW, I got a compiler error that said I could not use it. After changing MYROW to INT32, I no longer got the compiler error, but I got “Main has thrown an exception” “Message: The range does not exist” “Source: Write Value” “Exception Type: Excel Exception”


#7

i assume you are using the write value under excel application,what I suggested was using the “write cell” under file>workbook.

来自阿里邮箱 iPhone版 ------------------原始邮件 ------------------发件人:cisdenco uipath@discoursemail.com日期:2016-12-19 10:39:43收件人:robin.he@rpafintech.com robin.he@rpafintech.com主题:[UiPath Community Forum - Robotic Process Automation] [How To] Excel - How to move and write in the cell below?

          cisdenco
          

          December 19
        
      
    
  


  When I tried "B"&MYROW, I got a compiler error that said I could not use it.  After changing MYROW to INT32, I no longer got the compiler error, but I got "Main has thrown an exception" "Message: The range does not exist" "Source: Write Value" "Exception Type: Excel Exception"

Visit Topic or reply to this email to respond.

In Reply To



  
    
      
        
          
        
        
          robinhe69
          

          December 17
        
      
    
  


  Just use "B"&myrow ,instead of "B1"+myrow.

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.


#8

Please make sure you have opened your workbook using excel application scope. I have just tested again using the write value. It works well.

来自阿里邮箱 iPhone版 ------------------原始邮件 ------------------发件人:cisdenco uipath@discoursemail.com日期:2016-12-19 10:39:38收件人:robin.he@rpafintech.com robin.he@rpafintech.com主题:[UiPath Community Forum - Robotic Process Automation] [How To] Excel - How to move and write in the cell below?

          cisdenco
          

          December 19
        
      
    
  


  When I tried "B"&MYROW, I got a compiler error that said I could not use it.  After changing MYROW to INT32, I no longer got the compiler error, but I got "Main has thrown an exception" "Message: The range does not exist" "Source: Write Value" "Exception Type: Excel Exception"

Visit Topic or reply to this email to respond.

In Reply To



  
    
      
        
          
        
        
          robinhe69
          

          December 17
        
      
    
  


  Just use "B"&myrow ,instead of "B1"+myrow.

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.


#9

MYROW starts at 0 and there is no B0 cell.

You’ll probably want to start at B2. Therefore you’ll use "B" + (MYROW+2).ToString which outputs B2, B3 and so on.


#10

Thank you everyone and @badita your solution worked.


#13

@SHAISTA,
Write row value


#14

myrow>200


#15

try to write csv