Hi Team,
I have a datatable and Sharepoint list with the same headers (Same number of rows and column)
Now I want to update the datatable to the SharePoint list
Can Anyone help?
@Palaniyappan @Yoichi Can you guide me?
Hi Team,
I have a datatable and Sharepoint list with the same headers (Same number of rows and column)
Now I want to update the datatable to the SharePoint list
Can Anyone help?
@Palaniyappan @Yoichi Can you guide me?
@u322805
Can you try these steps:
Use add list items activity and pass the datatable as input
And the first row in datatable should be the column names in sharepoint you want to add to…and from second row you can have data
Cheers
@Anil_G Thanks for your reply
Am getting the add list item like this
No field to pass datatable
Can you please confirm if you are using office 365 activities or sharepoint activities
Cheers
@Anil_G am using SharePoint Activities
You want to update or add?
If add then need to use in a loop as we have option to add only 1 item once
If upfate…then g
First do get items…then in loop update the values and then use update items
Cheers
@Anil_G Thank you
I want to add, may I know what is the input that should be given to the Prop Dictionary Field?
I have my data in a data table, or should I install any packages to get activities in which datatable can be given as input?
Add items takes a dictioanry type variable in which key is the field name and value is the corresponding value for that column/field
Create dictionary of dictionary(string,string) and initialize it with dictionary(of string,string)
You can create usingn assign dict("columnname") = "value"
Then the dictionary can be given as input to add items
You can as well download official UiPath office 365 activities but it needs a different authentication not sure if you have that setup
https://docs.uipath.com/activities/docs/office365-setup
Cheers
Hi @raja.arslankhan Thank you for your reply
How to I give the datatable input to the Prop Dictionary field or should I install
Hi @Anil_G thanks again
I have tried as you have instructed
Below is the data table
This is the UiPath Workflow I did
The output I received is
Now am getting the first column value as “Key” and the second column value as “Dictionary Value”
But I want the Key as Header and the Value is first row value
Can you guide me on this, thanks
Update field would be the column name directly or use dt.Columns(0).ColumnName
And update value would be currentrow(0).ToString
And if you keep add inside loop it would add item for every iteration
Ideally for evry row you have to use another for loop for all column inside so that dictionary will be hving all columns values
In the first loop use this is to initialize dictionary dict = New Dictionary(Of string,Object)
Basically inside the for loop use another for each with dt.Columns and use type argument as columns
And use assign inside it and give
dict(currentitem.ColumnName)=currentrow(currentitem.columnname).ToString
Cheers
Hi @Anil_G Thank you for the tips
I did as you instructed but columnname is taken as the value and not header
Workflow Used:
This si what you have to use…you assigned both as values
Cheers
Keeping : in between wont create a dictionary
Datatable for loop is to be present outside and column loop should be inside
Cheers
Hi @Anil_G I tried
Below is the workflow and output
Issue: Not Updating in the same row and not iterating through next column values column headers are ok though
Hi @Anil_G ,
Thank you for this
Used this any idea why the Sharepoint list is updating values in the new row each time instead of updating in the same row
And How to assign the value (in the dictionary) to add to Sharepoint List
Can you please show a full screenshot of a your workflow…
Looks like what you did is to use for loop on column and then used currentrow(0).ToString as value…
So the same value is added to dictionary but with different column names as you are looping on column and for each column a new item is added as add item is present inside the loop
What I showed in screenshot is different and what you used is different…currentrow(0) will always take the first column value only
Cheers
Hi @Anil_G ,
Attaching the XAML file below with this workflow am able to get the details as expected except that list is being added in new rows each time,
I believe Sharepoint sequence should be outside of For each Column loop, so I
tried adding Key and Value to Dictionary inside this loop using “Add to Dictionary” activity and then pass this dictionary variable in Add Item to Sharepoint activity
But the dictionary type is different
Dictionary I initialized is of type Dictionary(of String, Object) but add to Dictionary is expecting Dictonary (of String, String),
how do we deal this
TestingAddListdata.xaml (16.0 KB)
Output Image