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
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 488 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives