Python Bite - upload file to Sharepoint Online with Python

  Рет қаралды 47,346

Python Bites

Python Bites

Күн бұрын

Пікірлер: 102
@TheNishi42
@TheNishi42 5 жыл бұрын
Hi Can you tell how to download the file from sharepoint.
@lsteveol
@lsteveol 4 жыл бұрын
I rarely comment on YT vids, but this one deserves it. Worked well, thanks for sharing.
@radoslawszwarc
@radoslawszwarc 4 жыл бұрын
Thanks mate!
@krishna-rk1nh
@krishna-rk1nh 5 жыл бұрын
Hi , how to download a file from a share point.
@joshi24036
@joshi24036 4 жыл бұрын
Could you also tell us how to download a file from share point. Please make a video or share the code. Thanks in advance.
@blizzbitz
@blizzbitz 5 жыл бұрын
The files does not appering in the folder
@ramonabreu4266
@ramonabreu4266 4 жыл бұрын
Thanks for this video, it is of tremendous help. I have a quick question; what is the difference between the "sp_site_name" and the "sp_doc_library"? what goes in each one in your example? it seems the doc_library is the actually folder you want your document to be uploaded to, but the site_name I am not sure what goes here. Thanks in advance for your response
@sandrakusnir
@sandrakusnir 3 жыл бұрын
also need help with this
@SJ-qq2dq
@SJ-qq2dq 5 жыл бұрын
My code executes fine but the file does not appear in the folder. Possibly a checkin issue? How con we enforce a check-in after the upload?
@blizzbitz
@blizzbitz 5 жыл бұрын
Same here
@ryanroline7181
@ryanroline7181 4 жыл бұрын
Hello! I followed this tutorial exactly and when I run the script it succeeds without an error like you showed in the video; however, the file does not appear within the document library. Without an error it is really hard to troubleshoot. I have already rechecked the site URL and folder destination along with user permissions to that folder. Any ideas?
@JHJ5288
@JHJ5288 2 жыл бұрын
Thank you so much for this video! True life-saver :)
@priyashegokar5017
@priyashegokar5017 4 жыл бұрын
I want to upload excel file and follow your code I don't get any error but in share point folder there is no file please sir can you help me
@jakeg9711
@jakeg9711 4 жыл бұрын
Thanks for the video, would we also be able to see how to download files from a Sharepoint list? Thanks :)
@homanjj3
@homanjj3 5 жыл бұрын
Thank you Python Bites. How would I upload to a sub directory of the document library?
@radoslawszwarc
@radoslawszwarc 4 жыл бұрын
You would have cycle through files in folders, and upload one by one using nested loop. You can have a look at os.walk('path_to_folder')
@boomikauba5232
@boomikauba5232 10 ай бұрын
Could you please give us the link to how to upload files to document library using client id client secret ??
@pythonbites2244
@pythonbites2244 6 ай бұрын
Hi Guys, documentation on "uploading" files can be found here: learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
@acomathes
@acomathes 3 жыл бұрын
Your patreon page seems empty... I'd really love to have access to your code.
@pythonbites2244
@pythonbites2244 3 жыл бұрын
Hi Ahmet, yeah, I was looking if people are going to the patreon page to get code, but there were no entries, so I didn't post much there. Maybe I will post some interesting stuff there if it will get some traction.
@pythonbites2244
@pythonbites2244 3 жыл бұрын
I just noticed, that Patreon "unlaunched" my site, so it was not even accessible. Would be good if they would notify me about that. If you want code for this video, it should be now available for download
@mysteryhogs2028
@mysteryhogs2028 4 жыл бұрын
How about if you are using Single Sign On instead of Username/Password ? any advise? this is so helpful. Answer please
@radoslawszwarc
@radoslawszwarc 4 жыл бұрын
I would have to look into it. I cannot promise I will do it.
@mysteryhogs2028
@mysteryhogs2028 4 жыл бұрын
@@radoslawszwarc 😂 python using username and password is easy no coding required using Curl command but doesnt work with SSO 😂 In PowerShell this is easy too... but what i wanted to do is from linux using python to SP site to upload files
@AmadoRodrigoRodriguezHeras
@AmadoRodrigoRodriguezHeras Жыл бұрын
Has the class changed or something like that? When executing the code, it shows the error: KeyError: 'x-requestdigest'
@poloperson4072
@poloperson4072 3 жыл бұрын
How would you upload associated meta data along with the file?
@Fireheadman
@Fireheadman 4 жыл бұрын
used your code.... however I believe this will not work for a federated sharepoint site? would you happen to have any experience with that?
@praveenmeruga1220
@praveenmeruga1220 3 жыл бұрын
@Python Bites, I don't have access to domain, but I have access to sub folders. From code I'm getting authentication error, can you please tell me however shall I proceed now.
@SatyamKumar-pi6pj
@SatyamKumar-pi6pj 2 жыл бұрын
What is the maximum file size that can be uploaded?
@jeanrodriguez1186
@jeanrodriguez1186 3 жыл бұрын
Hi, Is it possible to reference a different file path for the file_name ie. C:\user\documents\myfile.txt ? Every time i try to enter a full file path in the file name the fails. Thank you
@Nico-hf6hw
@Nico-hf6hw 3 жыл бұрын
But this is only for sharepoint 365 right? and not for Sharepoint online/on-premise?
@itamarmenezesdasilva6779
@itamarmenezesdasilva6779 Жыл бұрын
Thanks for helping us
@joshi24036
@joshi24036 4 жыл бұрын
Hi, I am getting below error, can anyone help? session.headers.update({'X-RequestDigest': response.headers['X-RequestDigest']}) return self._store[key.lower()][1] KeyError: 'x-requestdigest'
@sandrakusnir
@sandrakusnir 3 жыл бұрын
I need help with this too
@RaviYadav-bu2pg
@RaviYadav-bu2pg 4 жыл бұрын
Hi, Nice video, I am facing one issue, trying to download files from sharepoint through REST API but token gets expire in 1 hour, do you know any way to get refresh token for a long time like years, I am using Microsft graph.
@vaibhavagrawal9059
@vaibhavagrawal9059 3 жыл бұрын
Hi Ravi, I am also looking for the code to download the files from SharePoint, if you can mail me that code .. it will be helpful.. Mail id: vickyvaibhavagr@gmail.com Please respond here as well Thanks
@1lazyworld
@1lazyworld 4 жыл бұрын
you failed to censor the video ar 4:55, when you tried so hard at every other time you showed the webpage. Why?
@radoslawszwarc
@radoslawszwarc 4 жыл бұрын
my mistake, I have to cover it as well. Thanks for pointing it out, I must have missed it.
@暐陳-b2m
@暐陳-b2m 4 жыл бұрын
I want to update to specific Sharepoint file but don't want to overwrite the excel file, what I want is update the sheet1 in excel file. Ex, upload file test.xlsx to Sharepoint and won't replace the test.xslx but update the data in sheet1 of test.xslx. How to do it? Thx for your help!
@samson_afolabi
@samson_afolabi 4 жыл бұрын
I have exactly this same problem, could you share with me how you were able to solve this.
@yipengtang957
@yipengtang957 4 жыл бұрын
Looks like you hard coded your username and password in the config file. How can we use default windows login information for auth so that username and password will not be needed?
@radoslawszwarc
@radoslawszwarc 4 жыл бұрын
This is more "universal way' it works on both Linux and Windows. On Windows I'm sure you can get "username" via os.getuid() or os.getlogin(), however I'm sure password cannot be obtained. You would have to get a token from "Office365" single sign on (or something like that).
@nelsonai5481
@nelsonai5481 4 жыл бұрын
can you send me the code? the links you provided are not working and there are parts in the video where you did not scroll to the right to see the entire code.
@pythonbites2244
@pythonbites2244 4 жыл бұрын
True, I have turned off this web site. I will be using something "free" to post code. I will upload it to "Patreon" and will share you a link soon.
@pythonbites2244
@pythonbites2244 4 жыл бұрын
You can find this code here: www.patreon.com/posts/39879423
@weirdweirdman6155
@weirdweirdman6155 2 жыл бұрын
what is in the config file though
@Coolmadi
@Coolmadi 4 жыл бұрын
This code will not work if my company account has MFA enabled right?
@YogBar
@YogBar 4 жыл бұрын
It won
@暐陳-b2m
@暐陳-b2m 4 жыл бұрын
If your company account has MFA enabled, you have to build the App_password to replace your account's pwd. My code work nice and tight.
@rajgrg01
@rajgrg01 4 жыл бұрын
​@@暐陳-b2m​ App password - you mean normal app password, or we need to register app & get secret?
@暐陳-b2m
@暐陳-b2m 4 жыл бұрын
raj grg For example like this one dms-shuttle.com/documentation/connect-sharepoint-office-365-multi-factor-authentication-mfa/
@omoladeariyo3295
@omoladeariyo3295 2 жыл бұрын
The config.py file you referenced is not included. Thank you for the information.
@rajd26
@rajd26 3 жыл бұрын
I wan to read excel file(with 3 sheets) present in Sharepoint path, also wan tto read only 3rd tab in pandas dataframe and then post those records in snowflake
@pythonbites2244
@pythonbites2244 3 жыл бұрын
Well, here you have to do couple of different things... 1) log into sharepoint 2) download file 3) open with pandas -> df = pandas.read_excel( file, sheet_number=2) 4) prepare df (dataframe) to be loaded into DB 5) insert or update in snowflake.
@rajd26
@rajd26 3 жыл бұрын
@@pythonbites2244 Thanks.. Below is link looks like for sharepoint file, what should be there in config file for config['sp_base_path'] , config['sp_site_name'] and config['sp_doc_library'] companyname.sharepoint.com/sites/IT/EIA/ENTINT/information_movement/System%20Documentation/Support/COGNOS/Cognos%20Support/Team_oncall_log.xlsx
@vr-oo7uv
@vr-oo7uv 5 жыл бұрын
Hi I am getting error raise Exception('Check username/password and rootsite') Exception: Check username/password and rootsite. But i have given everything correct path and username and password but it throws error at first level of checking the cookies. It think it is autentican issues and please can you clearly explain what is sp_base_path, sp_site_name, sp_doc_library in sharepoint link, which one i need to segregate it.
@vasavigoudbojja
@vasavigoudbojja 5 жыл бұрын
Even am facing the same 'check username/password and rootsite' exception. can some one help with this . thanks in advance
@radoslawszwarc
@radoslawszwarc 5 жыл бұрын
on this site: pythonbite.tech/11-blog/python-advanced/4-uploading-files-to-sharepoint you have: config = dict() config['sp_user'] = 'some_user@example.com' config['sp_password'] = 'Passw0rd' config['sp_base_path'] = 'example.sharepoint.com' config['sp_site_name'] = 'my_site_name' config['sp_doc_library'] = 'PythonUploader' This is very clear and precise, where to use slashes etc. Will be hard to help you without knowing what you have put in the config.py file.
@krishna-rk1nh
@krishna-rk1nh 5 жыл бұрын
@@radoslawszwarc Can i get your mail id please
@angeleong23
@angeleong23 2 жыл бұрын
@@radoslawszwarc may I know how to get 'sp_site_name'?
@islauddinmohammed8220
@islauddinmohammed8220 2 жыл бұрын
I am trying to download files from Sharepoint. But getting the below error message... Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance.') Any suggest what might be missing or how to bypass this?
@franmer7
@franmer7 2 жыл бұрын
Thats a security policy set up on infrastructure level in your company. Contact your infra team because maybe they can remove that restriction for your specific use case.
@93RCOral
@93RCOral Жыл бұрын
Hey thanks so much !!!
@ravivenkatatejamucharla1802
@ravivenkatatejamucharla1802 2 жыл бұрын
Hi, can u pls let us know how to do this with client id and secret key
@pythonbites2244
@pythonbites2244 Жыл бұрын
I have recorded another video how to connect to Microsoft Graph using python msal library. You can try it from there, but the API calls will be different.
@rafael-ksouza
@rafael-ksouza 3 жыл бұрын
Thanks a lot! God bless u
@marcozacaria3371
@marcozacaria3371 2 жыл бұрын
Hi Sir , thank you for the great video. I am getting this error: raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text) Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50056: Invalid or missing password: password does not exist in the directory for this user.') i would really appreciate your help
@odiionhongo7885
@odiionhongo7885 3 жыл бұрын
anyone knows how to put a comment when i upload a file?
@pythonbites2244
@pythonbites2244 3 жыл бұрын
I haven't tried that unfortunately :/
@RavianXReaver
@RavianXReaver 4 жыл бұрын
Sharepoint has the worst api ever build
@krishna-rk1nh
@krishna-rk1nh 5 жыл бұрын
can anybody Please respond it. About the error I am getting.
@radoslawszwarc
@radoslawszwarc 5 жыл бұрын
on this site: pythonbite.tech/11-blog/python-advanced/4-uploading-files-to-sharepoint you have: config = dict() config['sp_user'] = 'some_user@example.com' config['sp_password'] = 'Passw0rd' config['sp_base_path'] = 'example.sharepoint.com' config['sp_site_name'] = 'my_site_name' config['sp_doc_library'] = 'PythonUploader' This is very clear and precise, where to use slashes etc. Will be hard to help you without knowing what you have put in the config.py file.
@krishna-rk1nh
@krishna-rk1nh 5 жыл бұрын
@@radoslawszwarc what should i need to place in this line---> config['sp_site_name'] = 'my_site_name'
@pythonbites2244
@pythonbites2244 5 жыл бұрын
@@krishna-rk1nh Let's say that this is a full address of a site: some_site.sharepoint.com/sites/p2p/SitePages/Home.aspx. In this case, you would have to put 'p2p' under this variable name. So config['sp_site_name'] = 'p2p' in this case.
@krishna-rk1nh
@krishna-rk1nh 5 жыл бұрын
@@pythonbites2244 Thank you so much
@vaibhavagrawal9059
@vaibhavagrawal9059 3 жыл бұрын
hello thanks for this, what if I want to download multiple folders and files from sharepoint to local fileshare? If anyone can help me for the same that would be very helpful. Please help me
@xali2008
@xali2008 3 жыл бұрын
is there a reason to use this instead of Microsoft Graph?
@pythonbites2244
@pythonbites2244 3 жыл бұрын
Would you be so kind to point to the Microsoft Graph API that is capable to upload a file to a SharePoint Document Libraty?
@manavsingh1160
@manavsingh1160 4 жыл бұрын
No you can't it's wrong code
@ArunKonkati
@ArunKonkati 8 ай бұрын
ImportError: cannot import name 'config' from 'config' (/usr/local/lib/python3.8/dist-packages/config/__init__.py) - can you please help me why Im i getting this?
Authenticating with SharePoint Online using Python MSAL library
16:52
Upload and Delete file to Sharepoint with Python
44:55
I am Lu
Рет қаралды 42 М.
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 33 МЛН
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 20 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 21 МЛН
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 817 М.
The most important Python script I ever wrote
19:58
John Watson Rooney
Рет қаралды 209 М.
How To Access SharePoint List Using Python
35:27
I am Lu
Рет қаралды 55 М.
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 43 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
File Uploads in React (Complete Tutorial)
25:31
Cosden Solutions
Рет қаралды 13 М.
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 33 МЛН