API to Upload a .csv File from Local Folder to a Smartsheet
Hi Smartsheet friends,
I've been trying to work out a solution for the below and wanted to reach out to the Community to see if this has been accomplished before or if this is even possible. I also want to preface that I am new to API's and development as a whole.
I have a report that automatically runs daily as a .csv file and drops into a folder on my PC. My idea is to leverage Smartsheet API to grab that file and upload it as an attachment to an existing Smartsheet.
I have researched the Developer site, SDK's, Smartsheet API documentation, Smartsheet Bridge, Smartsheet Community, and even had a Smartsheet Pro Desk session; however, I still am coming up short with answers for these questions:
- Where do I put the code that I either write or grab from the Smartsheet API documentation? For example, does this go in Visual Studio or another application?
- How does the API get "triggered" to run and grab the .csv file from the folder on my PC?
I'd love to hear from you all to see if this is something that may have been successfully set up as well as any pointers you might have for this newbie. Thanks in advance!
Answers
-
So, not only is this possible, but is exactly the type of stuff an API is designed to do. I don't know your software specifics, but it is even possible to link your report creation with Smartsheet directly, skipping the conversion to csv step.
I generally use python for my programs, but any software language that supports REST calls will do, including just using cURL in your command line. It would be good to get some basics on how development works. Here's a link to get the basics on cURL for command line: https://www.linode.com/docs/guides/curl-for-rest-api/
Generally speaking, as long a the language is installed on your machine, you can run your utility in the command line, from a script file, in IDE (like Visual Studio), etc. Your script should be written to handle importing a CSV and converting it to a format that the API accepts, probably json.For me, my steps are:
-install python 3.12 to PC
-install several python packages (requests, json, pandas, numpy,python-smartsheet)
-make a script that converts the csv to json
-use the requests package to structure my API call
-attach my json as the API payload and execute the request method.
If you'd like more info or an example script, I can try to provide. Do note, you have to understand how REST works before any of the other steps will be clear.
-
You can also do this without the api. On your local PC mount either google drive or onedrive as a network drive and have the report drop the file there. Then you can use Data Shuttle to automatically import the csv file to a sheet. Then use Data Shuttle to export the sheet as a csv as an attachment.
/marc
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65K Get Help
- 441 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 69 Community Job Board
- 497 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives