![]() ![]() # Open the spreadsheet sheet = client.open("NewDatabase").sheet1 # read csv with pandas df = pd.read_csv('football_news') # export df to a sheet sheet.update( + df.values.tolist()) In this case, I’ll use a CSV file that you can find Google Drive or my Github, but feel free to use any CSV file you want.įinally, we upload the data to our sheet using the. Then we read any CSV file we have with Pandas. ![]() Now it’s time to open the sheet and upload data to it. sheet.share('your_email_goes_here', perm_type='user', role='writer')Īfter running the code above, the sheet will be in the “Shared with me” section in your Google Drive. Let’s share this sheet with our own Google account. ![]() To access this sheet with our own Google account, we must share it with our email Sharing a spreadsheet Note that this new sheet is only visible to the service account we created before. create method of the client variable we defined before. Let’s create a new spreadsheet named “NewDatabase” In the code above, we enable access to specific links in the scope list, then in the credentials variable we write the name of the JSON file we downloaded before.įinally, we create a client variable. If you don’t feel like reading, you can watch my video instead! Bonus: Open Any Google Sheet File with Python Turning Google Sheets into a Database with Python - Connect to Google Sheets - Create a blank spreadsheet - Sharing a spreadsheet - Open the spreadsheet and upload data 3. We’ll learn how to create a spreadsheet and save data to it using Python, so you can turn Google Sheets into your own database. In this guide, I’ll show you how to use Google Sheets with Python. You can also edit and delete data with a couple of clicks and, on top of that, access your data online.Īlthough Google Sheets has limitations such as the numbers of cells you can use (up to 10 million cells) and API calls you can make per minute, it’s still a good option that you can get for free. Google Sheets is a cloud-based spreadsheet application that can store data in a structured way just like most database management systems. Image via Shutterstock under license to Frank Andradeĭid you know Google Sheets can be used as a lightweight database? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |