Skip to main content

Automating SharePoint List Data Insertion into SQL Table Using Automation Anywhere

  • March 10, 2025
  • 6 replies
  • 458 views

madhu subbegowda
Most Valuable Pathfinder
Forum|alt.badge.img+6

Introduction:
Organizations use SharePoint Lists to efficiently manage structured data, but often, this data needs to be transferred to an SQL database for reporting, analytics, or further processing. Manually handling this process can be time-consuming and prone to errors. Automating it using Automation Anywhere ensures data consistency, eliminates manual effort, and improves efficiency.

In this blog, I will walk you through the steps to read rows from a SharePoint List and insert them into an SQL table using Automation Anywhere.


Prerequisites
Before we begin, ensure you have the following:

  • Access to Automation Anywhere Control Room and Bot Creator
  • A SharePoint Online List with the required data
  • An SQL Database with an appropriate table structure
  • ODBC or direct database connection to insert data into SQL

Step 1: Set Up API Access for SharePoint

To interact with SharePoint, you need to configure API access:

  • Set up API permissions for your SharePoint site.
  • Obtain the OAuth2 API keys and the subdomain for your organization.
    • Example: If your SharePoint site is www.contessa.sharepoint.com, your subdomain is contessa.

Step 2: Connect to SharePoint

  • Use OAuth2 authentication to connect to SharePoint.

 

Step 3: Retrieve SharePoint List Items

  • Use the "Get List Item" action in Automation Anywhere.
  • Provide the Group Name and List Name.
  • Store the retrieved values in a List variable.

 

Step 4: Loop Through List Items

  • Loop through each dictionary variable to extract individual values.

Step 5: Assign Values to Variables

  • Assign required column values to respective variables for further processing.


Step 6: Insert Data into SQL Database

Now that we have extracted SharePoint data, we can:

  • Use inline SQL queries to insert data directly.
  • Write a Stored Procedure (SP) for insertion.
  • Store the extracted data in any document (excel etc) for further processing.

Conclusion

By automating the extraction of SharePoint List data and inserting it into an SQL database using Automation Anywhere, organizations can streamline data processing and improve accuracy. This method ensures seamless data synchronization while reducing manual effort.

 

Happy coding...!

 

For any questions or further assistance, feel free to connect with me on https://www.linkedin.com/in/madhukumarts/

6 replies

Chance.Lambert
Pathfinder Community Team
Forum|alt.badge.img+3
  • Pathfinder Community Team
  • March 10, 2025

@madhu subbegowda Thank you for taking the time to capture this detail and provide steps. It’s really helpful, and I know other community members would value this as well. Do you mind if we share in the Developer Forum? 


madhu subbegowda
Most Valuable Pathfinder
Forum|alt.badge.img+6
  • Author
  • Most Valuable Pathfinder
  • March 11, 2025

Of course, Lu. :)


  • Navigator | Tier 3
  • June 25, 2026

This guide is very helpful, especially with the current task I’m trying to troubleshoot.

One step I am struggling with is how you knew how to identify the Key in Step 4. I am using the custom headers from my List, but these do not seem to match the key.

 

For example, if I use “Status” as they key it returns a blank

Any help you could offer would be great.

 


PMosman
Navigator | Tier 3
  • Navigator | Tier 3
  • June 26, 2026

@jane.neasham The key is the internal SharePoint column name, not the display name.  Usually these are the same but if the column name was ever changed after it was first created the two will not match.  For example, if your Status column was first created with the name “Bot Status” and then later renamed to “Status” then the key would need to be “Bot_x0020_Status”  (include _x0020_ for all spaces in a column name) instead of “Status”.   The most common example of this is the “Title” field which is automatically added when a new list is created a new list but frequently renamed to something else.   

To see what the internal SP column name is you will need to access the List Settings for that list.   If you don’t have rights to view the list settings for the list you are working with then you will need to work with your local SP Admin for assistance.  Alternately, if you can connect to the list via Power Query in Excel you can see the internal names there as well.  There may be other methods but those are the two I use the most. 

This is an example showing where to view the internal name using the list settings in SharePoint.  In this case the Title field was renamed to “Bot Name”:
 

 


PMosman
Navigator | Tier 3
  • Navigator | Tier 3
  • June 26, 2026

@jane.neasham It occurred to me after I posted earlier that you could also find your columns by running the task in debug mode and viewing the contents of the dictionary after the Get List Items action. 

I would just create a new task with just a few actions:  authenticate to SharePoint, Get List Items and then add a delay action right after.  Put a breakpoint on the delay and when you run the task in debug mode it will pause there and you can view the actual dictionary contents.  This way you will be able to see exactly what is being returned and so you can identify the keys you need.

The two screen shots below show the test SP task and the dictionary values that are returned.  In this case none of the columns have an internal SharePoint name that is the same as the display name.  Even the one that appears to be the same is actually not because there is a hidden space after the word “Lockbox”, represented in the dictionary by the “_x0020” at the end.  I’ve labeled them to show what columns match which dictionary value.  
 

Dictionary values returned at run time


 

Column Display Names

 


  • Navigator | Tier 3
  • June 27, 2026

Thank you. I’ve used the debugging method and this has worked perfectly.