Insert values in two cells horizontally + Skip a column

Hi, I am new to UIPath. I have to insert data into an ODS file. I’ve done the process of extracting the data, but I’m unsure how to go about inserting it. This is because I have to insert it horizontally because it depends on the date (in the first column).

Furthermore, I have to skip a column so it will not overwrite the data there. The greyed out details are the name of the hotels I’m doing this for. How can I insert values in two cells horizontally and skip a column? Below is a visualisation of what I want (and a screenshot of the actual ODS file).

Hello,

You can create an array of All the required column names(not header and required is A,B,D…) and ignore the column you don’t want to update.

The loop through this array and use a write cell activity. There in the Range you have to iterate the column names to write horizontally

Hi!
1st, how would I make the array? (I’m not used to UIPath)
2nd, would the method you suggest continue to work in a loop? Because for every two values I have to get, it is from one different file every time. thus the data inserted is per file basis.

for each link 
-> log in and access system
-> download file
-> extract data
-> insert into ods (two cells each time, going horizontal)

hi @jack.chan , I’m very sorry for tagging you. I just wanted to know if you think this is doable (and how it can be done). Feel free to ignore this post otherwise!

whats the data you want to insert?

I extracted them from a report file (in XLSX format), the data are:
TotalUse and Revenue. Pictured is one I did manually by using Write cell and assigning the range as B5 and C5 respectively.

image

Each of the report contains the hotel’s total room count for the day (TotalUse) and the total revenue for that day for all rooms (Revenue). As you can see from this ODS file:

Each red bar is a location’s name. and below the names, each have two columns, Room and Revenue. I have to download and extract a different file to fill in those two cells every time, and since it goes by date it has to be inserted horizontally. I also cannot overwrite the Date column in the middle.

Since all the values isn’t in one place for me to insert it at once, I wonder if there’s a way to make it go right two cells each time.

Example values are:
Hotel A=
TotalUse: 44
Revenue: 1445.80

Hotel B=
TotalUse: 21
Revenue: 1087.32

Hotel C=
TotalUse: 32
Revenue: 1365.65

Yes there is

whats the format of your hotel input data, can take a small screenshot or something?

If you mean the report file, here it is:


image

I have already made another XAML file to extract these. Just in case you want the XAML for extracting it:
ExtractData.xaml (14.4 KB)

(If you’re wondering why the ExtractData.xaml is like that, it’s because the location of the values I need is inconsistent for every file.)

something like this
create a columnNumber variable (integer) , initialize with 1

then when writing to cell , set cell to
UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(columnNumber)+"1"
e.g. if columnNumber=3 , it will write to C1, if colmnNumber = 4, it will write to D1
image
then after that set
columnNumber = columnNumber+2

image

1 Like

Is there a way to skip a specific column using this method?

yes, you can add another if statement
lets say you want to skip column “B”
put this in the if statement:

UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(columnNumber) = "B"
image

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.