New to API/python dvlpment- need help with directory path name
Hello,
I'm looking to develop a use-case using the smartsheet-python sdk. Can anyone give me an example for this line and how it should appear in the code block to successfully pull a sheet as csv from smartsheet to a local/shared folder-
download_directory_path
This is from the Get Sheet as Excel / PDF / CSV section on the api doc- https://smartsheet-platform.github.io/api-docs/
Thanks in advance.
Best Answers
-
download_directory_path
refers to the location where you want the sheet to be downloaded.For example, on mac it could be
/Users/genevievep/Downloads
Or linux
/home/genevievep/Downloads
Or Windows
C:\Users\genevievep\Downloads
You can specify any folder you want, and not just the default downloads folder.
Hope this helps!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Honestly, I’m not sure if its possible to specify a file name from the Smartsheet API. But if you're using the Smartsheet python SDK, you should be able to use the built in
os.rename
function to rename it:os.rename('default-sheet-name.csv', 'betterName.csv')
Here's some more information on this: https://docs.python.org/3/library/os.html#os.rename
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
download_directory_path
refers to the location where you want the sheet to be downloaded.For example, on mac it could be
/Users/genevievep/Downloads
Or linux
/home/genevievep/Downloads
Or Windows
C:\Users\genevievep\Downloads
You can specify any folder you want, and not just the default downloads folder.
Hope this helps!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
@Genevieve P Thanks, I found a syntax error in my code. Now it worked ! is it possible to rename file other than the default name from smartsheet?
-
Honestly, I’m not sure if its possible to specify a file name from the Smartsheet API. But if you're using the Smartsheet python SDK, you should be able to use the built in
os.rename
function to rename it:os.rename('default-sheet-name.csv', 'betterName.csv')
Here's some more information on this: https://docs.python.org/3/library/os.html#os.rename
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Python has an OS module that provides the functions to deal with file management. We can list files in directory and subdirectory programmatically in Python using the OS module.
We need to call the os.listdir() function recursively for subdirectories to create a complete list of files in a given directory tree.
The python os module provides the os.walk() function to iterate over a directory tree.
To list directories, subdirectories, and files in Python, it has excellent inbuilt support that does the job for you. File management and handling is a day to day operations for any programmers.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives