1006 error on an update to sheet with references

03/15/21
Accepted

I am having trouble making an update to a sheet. I am confident my code works because I can make successful updates on a test sheet that I setup. I created the test sheet by doing a 'save as new' on the original. So all the fields are exactly the same. I think the issue has to do with formulas and references to other sheets. There are also other sheets that reference this particular sheet. Are there known issues udpating a sheet via the API when that sheet is used as a reference in other sheets via vlookups? Other ideas?

I just get the basic 1006 error code: {"result": {"code": 1006, "errorCode": 1006, "message": "Not Found", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "ipwv0jbd19cx", "shouldRetry": false, "statusCode": 404}}

But like I said my python code definitely works on a one off smartsheet.

Thank you for any input.

Best Answer

  • Genevieve PGenevieve P admin
    Accepted Answer

    Hi @Rick Hendrickson

    I just tested on a sheet where I have Editor permissions and if you try to update a locked column you should receive this error:

    “errorCode”: 1039, “message”: “Cannot edit a locked column XXX"

    The error codes tend to be pretty specific. I can't see what's going on for your request as it would likely need me to see the full request and sheet(s) to troubleshoot.

    Trounleshooting Steps:

    1 . Row ID?

    What I would suggest doing is find that row with the Row ID identified in the error message to see if it has somehow been deleted or removed from the sheet.

    2 . Update Just One Row

    If your request is updating multiple row at once, try just updating one row as your first test. If this fails, check each of the column IDs to ensure no column was deleted since your first Get Sheet, or check that you're referencing a column in this current sheet (versus the test sheet you were working with before).

    3 . Sheet ID (again)

    In the update_rows command you noted earlier, you have the following:

       updated_row = ss.Sheets.update_rows(test_sheet_id, [new_row])

    Could you double check that this is the sheet_id and not your tester sheet? It should be the same ID as what's in sheet = ss.Sheets.get_sheet(sheet_id).


    Should none of this have helped, I would suggest reaching out to Smartsheet Support so they can troubleshoot with you in a private channel. You'll want to send them full screen captures of your requests, error result, along with the two sheet URLs that you're testing with. Please also provide them with the "refId": "XXXXXX" from the most recent error.

    I hope some of this has helped!

    Cheers,

    Genevieve

Answers

  • Here is a little more info. The sheet I am trying to update contains cells that are being referenced in other sheets. I don't have access to all of them through my account. Could that cause the issue:

    There are a number of "unknown sheets" that call about this data so I don't know if that could be causing the issue.

    Thanks!

  • Hi @Rick Hendrickson

    To address your second note and screen capture, the fact that cells in this destination sheet are being referenced won't affect your ability to update content, either manually or through the API (unless of course you only have Editor permissions on the destination sheet and these columns are locked, but then you should receive a permission-specific error). The cell content is being looked at from these other sheets, but not affected by these formulas.

    Additionally, the specific error you're getting (1006) is a "Not Found" error, which indicates that either the Row, Column, or Sheet you're looking to update cannot be found. (See: 400-Level Error Codes.)

    Is it possible that after you tested your code on the first sheet, you copied/pasted some of the content and the sheet ID Is still looking at the test sheet instead of the current, original sheet?

    The full error should also return the Row ID that caused the error, if that helps (see the Errors section of the Update Rows API Documentation).

    Let me know if you're still getting this error after confirming that the Sheet ID is correct!

    Cheers,

    Genevieve

  • edited 03/16/21

    @Genevieve P Thank you for your suggestions. I think you might be onto something. The destination sheet that references these cells I am updating does have 'locked' columns in the corresponding rows. And I only have editor permissions. I am requesting admin permissions but am not sure it will be granted.

    On your questions about the correct sheet ID, I do believe I have it set correctly. After I call the get sheet command I print the number of rows returned and the name, and it is successful.

    sheet = ss.Sheets.get_sheet(sheet_id)

    print("Loaded " + str(len(sheet.rows)) + " rows from sheet: " + sheet.name)

    results in: Loaded 570 rows from sheet: XXX sheet

    The error occurs after the script calls the update_rows command:

          updated_row = ss.Sheets.update_rows(test_sheet_id, [new_row])

          print(updated_row.message)

    Here is another look at the error code that includes the rowid:

    ERROR:smartsheet.smartsheet:{"response": {"statusCode": 404, "reason": "Not Found", "content": {"detail": {"index": 0, "rowId": XXXXXX}, "errorCode": 1006, "message": "Not Found", "refId": "XXXXXX"}}}

    I removed the rowid here because I am not sure if it can be used maliciously.

    Thanks again!

  • Genevieve PGenevieve P admin
    Accepted Answer

    Hi @Rick Hendrickson

    I just tested on a sheet where I have Editor permissions and if you try to update a locked column you should receive this error:

    “errorCode”: 1039, “message”: “Cannot edit a locked column XXX"

    The error codes tend to be pretty specific. I can't see what's going on for your request as it would likely need me to see the full request and sheet(s) to troubleshoot.

    Trounleshooting Steps:

    1 . Row ID?

    What I would suggest doing is find that row with the Row ID identified in the error message to see if it has somehow been deleted or removed from the sheet.

    2 . Update Just One Row

    If your request is updating multiple row at once, try just updating one row as your first test. If this fails, check each of the column IDs to ensure no column was deleted since your first Get Sheet, or check that you're referencing a column in this current sheet (versus the test sheet you were working with before).

    3 . Sheet ID (again)

    In the update_rows command you noted earlier, you have the following:

       updated_row = ss.Sheets.update_rows(test_sheet_id, [new_row])

    Could you double check that this is the sheet_id and not your tester sheet? It should be the same ID as what's in sheet = ss.Sheets.get_sheet(sheet_id).


    Should none of this have helped, I would suggest reaching out to Smartsheet Support so they can troubleshoot with you in a private channel. You'll want to send them full screen captures of your requests, error result, along with the two sheet URLs that you're testing with. Please also provide them with the "refId": "XXXXXX" from the most recent error.

    I hope some of this has helped!

    Cheers,

    Genevieve

  • Hi @Genevieve P !

    Holy cow you were right with the 'test_sheet_id'! I was using that variable in two places and only changed it up top where I initially get the sheet. I'm so glad I posted that update code and you pointed that out. Thank you so much for the detailed responses!

    Rick

  • Great news, @Rick Hendrickson! I'm glad you were able to get it working. 🙂

Sign In or Register to comment.