Connect with peers, share your expertise, and inspire what’s next in Smartsheet — from proven practices to practical how-to insights from fellow users and product experts.
Sign in to join the conversation:
The posts in this section are historical and no longer monitored for accuracy. If this discussion interests you and you'd like to join in, please visit the active Community to post and engage.
Is there sample code in C# to download data from a sheet to a local drive?
for some reason when I use the API and try to read the number of rows I always get null values
long? numRows = tmpSheet.TotalRowCount;
Thanks in advance
Hi Juan!
We have some basic code samples available in our API documentation. If you're looking to download a Sheet onto your local computer, I'd suggest looking at this section in our docs: http://smartsheet-platform.github.io/api-docs/?csharp#get-sheet-as-excel-/-pdf-/-csv
We also have SDKs available in C#, which may help you to get started with the API. You can download them here: https://www.smartsheet.com/developers/sdks
I hope this helps!
Cheers,
Joseph
Same problem. this is my code in pYthon 2.7, Debian OS, with ordinary user credentials. Tokens were substituted for security reasons.
OBJECUTVE: Read a certain SmartSheet, read thru its collumns and row and get some data, using API.
Please find below my code:
# -*- coding: utf-8 -*-#!/usr/bin/pythonimport smartsheet#Tokenplanilha = smartsheet.Smartsheet(MyToken)#SheetIdxSheetId = MySheetId#print Sheetprint 'Getting sheet %s' % (xSheetId)# Get sheetxSheet = planilha.Sheets.get_sheet(xSheetId)# print resultprint xSheet
When I run the above code, I get the following errors.
...
Getting sheet MyTokenTraceback (most recent call last): File "gestao6.py", line 16, in <module> xSheet = planilha.Sheets.get_sheet(xSheetId) File "/usr/local/lib/python2.7/dist-packages/smartsheet/sheets.py", line 460, in get_sheet response = self._base.request(prepped_request, expected, _op) File "/usr/local/lib/python2.7/dist-packages/smartsheet/smartsheet.py", line 179, in request native = res.native(expected) File "/usr/local/lib/python2.7/dist-packages/smartsheet/smartsheet.py", line 408, in native obj = class_(data, self._base) File "/usr/local/lib/python2.7/dist-packages/smartsheet/models/sheet.py", line 90, in __init__ self.columns = props['columns'] File "/usr/local/lib/python2.7/dist-packages/smartsheet/models/sheet.py", line 220, in columns if not isinstance(x, Column) else x) for x in value File "/usr/local/lib/python2.7/dist-packages/smartsheet/models/column.py", line 134, in __init__ self.options = props['options'] File "/usr/local/lib/python2.7/dist-packages/smartsheet/models/column.py", line 257, in options if not isinstance(x, str) else x) for x in valueUnicodeEncodeError: 'ascii' codec can't encode character u'\xda' in position 6: ordinal not in range(128)
If I run with Curl, with the same credentials
curl https://api.smartsheet.com/2.0/sheets/xSheetId -H "Authorization: MyToken"
I get the following error:
{ "errorCode" : 1004, "message" : "You are not authorized to perform this action.", "refId" : "1lym35mqns1bx"}
Any clues?