API - C# - Delete rows from a specific index

HoaLT ✭✭
edited 12/16/21 in API & Developers

Hi there,

I'm newbie on Smartsheet. I am working on integration of data from another system to Smartsheet through API.

The requirement is that we need to delete all rows from the fourth row to the last one of sheet then adding the new data into sheet every time we run API.

I've already implemented adding row data into sheet smoothly. However, the stuck is deleting from the fourth row.

I wonder if there is any way to delete data from a specific row through API. My project is working on the C#.

I would appreciate so much for those who can help me get out of this issue

Many thanks in advance!

Best Answer


  • HoaLT
    HoaLT ✭✭

    I 've figured out on my own the following function in NodeJs

    function resetSheet (sheetId) {


      // Get sheet


        .then(function(sheetInfo) {

          const rowIdList = sheetInfo.rows.map(item => item.id);

          return rowIdList;


        .then(data => {

          const deleteIds = data.splice(3);

          deleteIds.forEach(rowid => {


              sheetId: sheetId,

              rowId: rowid


              .then(function(results) {



              .catch(function(error) {





        .catch(function(error) {




    It works but sometimes, it does not delete all rows from the 4th to the end along with alerting the following error

    errorCode=4004, message=Request failed because sheetId XXX is currently being updated by another request that uses the same access token. Please retry your request once the previous request has completed

    Do i missed anything?

    And is there any better solution we can deal with it? Solution with C# would be appreciated so much

    Many thanks!

  • Genevieve P.
    Genevieve P. Employee Admin
    Answer ✓

    Hi @HoaLT

    Are you looking to clear cell details from row 4 or fully delete out the rows?

    Here's the Delete Row information from the API Documentation: https://smartsheet.redoc.ly/tag/rows#operation/delete-rows

    There's C# details on the right side. You may also want to post in the StackOverflow community for help with C#.

    If you're receiving errors, I would recommend reaching out to Smartsheet Support with your full code and the Sheet ID.



  • HoaLT
    HoaLT ✭✭

    Hi @Genevieve P.

    Thank you so much for your help.

    I 'm working on it.

    Hope you have a good day.