I'm looking to create a simple Python script that allows me to read from and write to public files, such as Google Docs or Excel sheets, directly from their URLs. The idea is that the file would be publicly accessible to anyone with the link, so my coworkers and I could update a shared document without having to download it. For instance, we have a public Excel sheet where we log our clock-in and clock-out times. It would be great if each of us could run this Python script on our own devices to update the file, and those changes should reflect for everyone since it's a public file. I've tried using the requests library and urlopen, and even tried converting it to a DataFrame, but I'm not getting it to work. Any guidance on how to approach this would be greatly appreciated!
4 Answers
It varies depending on the document type. For Google Sheets specifically, you'll find guidelines in this resource: [Google Sheets API Reference](https://developers.google.com/workspace/sheets/api/reference/rest). Make sure to follow those rules for the best results!
If by 'public file' you mean documents stored on services like Google Drive or Microsoft Office, you'll need to use their respective APIs to interact with those files. Just accessing the link won't cut it; APIs enable you to read and write directly.
Check out the official Google Sheets API documentation. Here's the link: [Google Sheets API](https://developers.google.com/workspace/sheets/api/guides/concepts). It'll give you a good starting point for working with Google Sheets in Python.
Hey, just a thought—consider alternative solutions for real-time collaboration instead of just file storage. There might be better tools available that suit multi-user projects!
I’m new to programming, so I’d love to hear about those alternatives!