Welcome to the Smartsheet Forum Archives


The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.

C# API Add Records from MS SQL Server

06/30/17 Edited 12/09/19

Hello, I'm trying to get records from a SQL table into Smartsheet using C# and ultimately SSIS (via script command).  I'm stuck on how to add the rows into Smartsheet.

1. I want to add the rows dynamically without having to code the column id.  I see that there is Bulk Operations but very little documentation for it.  This command seems to be possible without having to use a column ID: POST /sheets/{sheetId}/rows.   Does anyone know how to use this?  I'm guessing I would need to implement REST code in my C# app.

2. If I don't go with the above, is there a way to just loop through sheet columns and write the data from a SQL column?  I'm guessing I would have to dynamically pull the column ID.

Hope this all makes sense.

Comments

  • I actually figured this one out.  I took two approaches and ended up with one successful.  I tried the SDK, but I couldn't get it loop through both the SQL data and dynamically build the string for the Smartsheet columns.  So I ended up just looping through my data and building a JSON string and using REST to post.  It's actually much faster than the API.  If anyone is interested in seeing the outcome, let me know.  I'm sure there's an easier way, but I got the job done and the code is not super long.

  • Erik BeltranErik Beltran ✭✭✭✭✭

    Hi @jrichardw

    I am interested in seeing the outcome - i am using the SDK and i am not able to get it to work.

     

  • Erik BeltranErik Beltran ✭✭✭✭✭

    This is an old post but when i needed to get this to work i landed here and some others.

    I made it to work using Linq libray in C# and the result of my query will fill a DataSet. The next step is to iterate the records using UpdateRowBuilder. 

    The code is fairly simple and not very long. Ping me in case anyone is interested.

This discussion has been closed.