Foreach loop

I am connecting to smartsheet api and I am looping through the page to get all the values and insert them to mssql table. However when inserting, sometimes it skips the last value, it seems it is in the memory but is not inserted to the table.

Thank you.

I think we’ll probably need to see what you’re trying to do with your code in order to be able to spot if there’s anything you’re overlooking, or if it’s a failing in the API somewhere. :slight_smile:

Definitely need to see some code to provide any feedback.

Are you using the foreach keyword or the foreach-object cmdlet. It can be confusing but they are not exactly the same thing. The problem you’re describing sounds like a frequent problem that users of a do while loop experience, in that you’ve satisfied your exit criteria before completing what you wanted to do.