Hello all,
I want to insert an image from a folder in each cell till all the images in the folder are in different cells
Example: img1.png to cell 1 , img2.png to cell 2, img3.png to cell 3
I have used BalaReva. Excel activities and I’m able to insert one image into one cell but not sure how to make it a loop.
Kindly suggest,
Thanking you in advance
you want to insert horizontally (A1…B1…C1) or vertically (A1…A2…A3)?
use foreach loop , in Enumerable.Range(1,imageCount)
(imageCount = number of images)
in the loop insert image to cell,
cell address = UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(columnNumber)+"1"
How do I assign the images in the folder as a list to image count ?
do this instead (see xaml)
Main.xaml (7.2 KB)
this will loop through all the jpg files in folderPath, and insert image
Hello @Yugal_Raju ,
Directory.GetFile(Folerpath) can help you to get all the files name to an array. Then you can loop (for each) through each value and do the insertion.
Thank you,
How do I specify to add images from cell C4 onwards?
is this the order you want? if not can you state the order?
A1, B1, C1
A2, B2, C2
A3, B3, C3
A4, B4, C4
…
…??
Yes the count starting from C4,D4.E4,F4 etc
It is adding all the images to Cell C4 and not D4,E4 and so on
ushu
(Usha kiranmai)
May 9, 2022, 4:04pm
13
@Yugal_Raju May I know what is the Balareva activity that you were using to insert the image in excel
can you upload the xaml here…?
@Yugal_Raju
Hi Jack , I’m using the same xaml that you provided earlier
change cell to
UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(columnNumber+1)+"4"
and maybe its because the image is too big? maybe that will make it seem like its all in one cell, if they are smaller it will be clearer that they are in separate cells
ushu
(Usha kiranmai)
May 9, 2022, 4:25pm
18
@Yugal_Raju You can use the below expression in the loop to increment column character every time.
Convert.ToChar(Convert.ToUInt16(CharInput)+1)
The output you can pass to the activity through which you are inserting an image
Find below workflow for ref
Example.zip (65.6 KB)
Actually the image is getting copied into the cell but all the images are overlapping on a single cell rather than pasting in each cell one after the other
Hello Ushu,
I have used the code it is once again incrementing the pics in the same folder.