RickRollNGo RickRollNGo - 1 year ago 156
Python Question

Retrieving SmartSheet Content using Python SDK

so ill try to keep this short as possible. I am a newbie to the SmartSheet Python SDK and im trying to call all the data from the Smartsheet and hopefully use that as a starting point for myself. So far what I have

import smartsheet

smartsheet = smartsheet.Smartsheet('token1')

Which I am running/compile on Python Shell, and so far with those two lines I am running it and not getting an issue, when I try to implement anything else to pull the data, I keep getting errors.

on topic but a separate thing

I also have this line of code to pull specific line from the SmartSheet,

action = smartsheet.Sheets.get_sheet(SheetID, column_ids=COL_ID, row_numbers="2,4")

My question regarding this is, where do I find the Column ID, I know how to access the Sheet ID, but I cant access or find the Column ID on smartsheets, I dont know if i am overlooking it. Just looking to get off in the right direction, being the newbie I am, any help appreciated.


Task Name



Answer Source

The following sample code retrieves a list of all columns from the specified Sheet, and then iterates through the columns printing out the Id and Title of each column. (You'll obviously need to replace ACCESS_TOKEN and SHEET_ID with your own values.)

# Import.
import smartsheet

# Instantiate smartsheet and specify access token value.
smartsheet = smartsheet.Smartsheet('ACCESS_TOKEN')

# Get all columns.
action = smartsheet.Sheets.get_columns(SHEET_ID, include_all=True)
columns = action.data

# For each column, print Id and Title.
for col in columns:
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download