I am using add data row and write range activity.
In my excel sheet 100 records inserted.Now I want to add data when I executing application it replace 100 records with new one.
I want records inserted after 101 record.
hi @Aditya10989,
Apart from Append Range - We can Get the Dynamic cell in the Excel with steps below.
Lets say You have a Data till 100 Rows ans we want to Paste the data from A101
- We Read Range the sheet in excel and get the DataTable.
- We Count the No. of Rows in DT and store it in Integer variable say intCount- by using DT.Rows.Count - This will give you 100.
3.Take a Sting variable Say Range and assign : A+intCount.toString. - Use range from Step 3 for pasting the New Data.
–
Mukesh
this is not work for me
it remove my header while using write range
Please Check AddHeader Check Box in the Write Range Property - to Preserve Headers.
I think the DataTable is Null,
Can you try Inserting one sample Row of Data and then Write Range with Preserve Header Checked.
yes I don’t want data.Because data inserted dynamic it create inside for each and I am creating header outside for each
this is not work for me multiple condition.Can you tell me there any which can check in excel file sheet exist or not
not excel file sheet name
In your excel application scope you can use the “Get workbook sheets” activity. Save the output to a list<string> variable I’ll call xlSheets. Then in your if statement it should be if xlSheets.contains(“YourSheetName”)
Reference :
Sorry I have done huge code just because of I need to show demo in meeting meeting is over.Now can you explain me without data how we can add header…?
So if your datatable is empty and you attempt to write it in a excel… It will not write the data and datatable is blank and is having only header
Below I have suggested an alternative for this…
but the think is I am executing same excel file multiple time then it create multiple rows.
because I am processing huge data almost 20 k records.So I run this for 2 hour then stop so on.it create multiple header in between records.
So the main purpose of having header is to differentiate the data of various Runs ?
Plese correct.
means I am executing file multiple time because this is time taking process lets suppose first run its work fine I executed 1000 records now next execution after 1000 records it re create header in between data.
One think also work for me while executing second time it check header already exist or not if exist it skip build data table second or third time execution…?
- we can create 2 DataTable - one with only Header - dtHeader
- other with Header and one Row of Data (Same as Header) as shown in above threads -dtHeaderRow
3.Then we use an - IF Statement here and Checking the Datatable row count.
- If DT.rows.Count < 1 - That means DT is empty - we write range the dtHeaderRow
else
we wrrte Range the dtHeader



