Doubt in Excel automation


#1

Hello guys, i ve done a Web Scrapping of some values and i have written it in an Excel file, saving it also in a Data Table.

My doubt is: how can i get the last cell (value) of each row, save it like in an array or something, and see if each of that values stored is bigger or not that 2000. If it is less than 2000 i did a sequence to write in NotePad.


#2

Hi,

if your datatable’s last cell is always at the same column(all rows have the same amount of cells), you can do the following:
For Each row in myDT.Rows
if (row.Item(“myLastColumn”) < 2000)
Write row.Item(“myLastColumn”) to notepad

BR,
Topi


#3

@Topi can you pls help with this?
how to download excel from a location (say google)
do some modifications and email to some one?


#4

Hi,

The download part can be done just as a human would do it. For example, Open browser- activity with the url to the file and then read the file in an Excel Application scope. The default download location in English Windows is “C:\Users”+ Environment.UserName +"\Downloads\myExcel.xlsx". If the name of the excel is not known you can check for files ending with *.xlsx and if found open that. Directory.GetFiles(“path”, “pattern”) returns a string array of all the paths found.

Depends on the modifications you want to make. I usually prefer reading the excel- data in to a DataTable with Read Range activity. Then do the required modifications to the DataTable and write it in to a new excel file.

Sending an email is pretty straightforward. If you are using Outlook use the Send outlook mail message and in the attachments add your newly modified excel -file path.

If this was too confusing, let me know and I can try to make a sample workflow.

BR,
Topi


#5

Thank you it was informative. but being beginner It would be great if you can help me more in this.

Can you kindly create a simple workflow for my requirement?
Everything should be automated.
Example
1.Download excel file by name “Forbes Global 2000 - 2014.xls - Macrofocus” from google
2.from the excel sheets sort companies by country and get display comapanies from only “United states” and save
3.Then email to some from outlook.

Thanks


#6

Here is an example that creates a new sheet in the same excel file that has only US items.
Main.xaml (14.2 KB)

BR,
Topi


#7

Thank you so much…So kind of you.Though its not throwing any error. There is no email sent.
Pls look into this.


#8

The email To-address I put there was just some random example. Use your own/colleagues email there for example.

-Topi


#9

Yes… I did change it. But no rmail


#10

Do you have Outlook installed and an account set up on your conputer?

-Topi


#11

Yes , I did set up…


#12

@Topi thank you so much its working. Appreciate your patience and your time to help.