Linux Python 3.6 script example to download a Smartsheet?
I've been searching for several days for a Python SDK script to download a Smartsheet that I have previously created. I have an existing Smartsheet with 5 columns, and 2690 rows. I only want to download the first column which is a number and assign it to an array.
What I've tried so far:
EXCEL IMPORT
Smartsheet offers a solution where I can the Internet URL to the Excel Data Source. However, when I try retrieving the data, I get a timeout. There is about 2690 rows and 5 columns to download.
Searching the Internet, I found a potential Python solution using an app and attempted to install pip install simple-smartsheet. The install results in "already satisfied" messages when running.
However, when I try to run their example script:
SCRIPT START
import os
from datetime import date
from pprint import pprint
from simple_smartsheet import Smartsheet
from simple_smartsheet.models import Sheet, Column, Row, Cell, ColumnType
# SMARTSHEET_API_TOKEN is in the Environment
TOKEN = os.getenv("SMARTSHEET_API_TOKEN")
SHEET_NAME = "[TEST] My New Sheet"
smartsheet = Smartsheet(TOKEN)
I get the error:
pi@SmartSheet:~/Documents/tscripts $ ./mat.py
./mat.py: line 1: import: command not found
from: can't read /var/mail/datetime
from: can't read /var/mail/pprint
from: can't read /var/mail/simple_smartsheet
from: can't read /var/mail/simple_smartsheet.models
./mat.py: line 8: syntax error near unexpected token `('
./mat.py: line 8: `TOKEN = os.getenv("SMARTSHEET_API_TOKEN")'
SCRIPT END
Thank you!
Mike
Answers
-
I think you need to either add the following as the first line of your script:
#!/usr/bin/env python
or
#!/usr/bin/python
or
invoke it on the command line with python mat.py or python3 mat.py
Also, if you have access to Microsoft Power Automate, you may be able to use Power Automate with an HTTP request to Smartsheet, copy the column to an Excel Spreadsheet and use the Transpose formula in Excel (No code required).
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.6K Get Help
- 403 Global Discussions
- 215 Industry Talk
- 455 Announcements
- 4.7K Ideas & Feature Requests
- 141 Brandfolder
- 136 Just for fun
- 56 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 296 Events
- 36 Webinars
- 7.3K Forum Archives