How to read, write into same excel?

Hi Team, i am using an excel file to extract data from internet, but i am unable to write the same data into excel,
for example : for each row get the data and write into “L”

Hi @rahul_gola

You can read excel using read range activity
Give your excel file path in the path tab, and give extact sheet name of your input excel in the sheet name tab , if you want read the complete data of your input sheet then leave the range tab as empty

If you to write a datatable into excel use write range activity, and give starting index like A1 or B1 where you want to start writing into excel , while writing data into excel if the specified cell already has data it will overwrite that cells or if your destination excel doesnot exists it will create new excel and write data into that excel

Hope its solves your issue

Thanks,
Robin

Hi Rahul ,

You can use of Read range and Write Range activity inside the Excel Application Scope to write in to the same Excel file.

Thanks,

Hi @rahul_gola ,

Please follow below steps to achieve your requirement.

  1. Use excel application scope and assign your input excel file path.

  2. Inside excel application scope use excel read range to get the whole data into a data table DTInput.

  3. Use For each row loop and assign your inputDT and use the below expression to get the current row data

ValueUsedtoGettextFromWebsite = CurrentRow(“YourColumnNameUsedtogetdatafromweb”).tostring

  1. Use the above variable and use gettext or whatever your ui auotmation and get the data from the webisite and store the output in a variable Weboutput.

  2. Use write cell activity in the for each row loop itself and enter your sheet name and under range use he following expression →
    “L”+(cint(inputDT.Rows.IndexOf(CurrentRow))+2).ToString

it will help you to store the output in the L column by using row index.

At the end of the loop you would get all the website text output should be stored into your L column.

Please try the above steps and let us know. if you still faces any issue please share us the screenshot of the issue you are facing. thanks.

Hi @kirankumar.mahanthi1,

Thank you very much for your quickresponse, i have tried the above. but it is not working. could youplease explain, inputdt and DTinput.

and what is valueusetogettextfromwebsite and CurrenRow

Thank you very much again,

Hi @rahul_gola ,

I mentioned two times but both input dt and dt input are same. I mean this is the datatable which is having all your data from input excel which you mentioned in your post which is used to enter the data in the web application.

valueusetogettextfromwebsite is variable which is holding the data you are trying to extract from the web application.

CurrentRow I mentioned it is the list item from the for each loop which we can use to get excel data one by one.

Could you please share your work flow or screenshot what you are trying. If will be very helpful to guide you in better way. Thanks.

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