I have a small Python app that provides a GUI to update a Google sheet using PysimpleGUI.
I would like to convert it to an EXE file using pyinstaller so that the non-technical user will be able to make use of it easily.
The process works fine, but I need to keep the JSON key file “next” to the EXE file for it to run (the JSON provides the authentication key for access to the Google sheet).
Is it possible to embed the JSON in the python file so it gets included in the conversion process?
If not, is there another way to make this as simple and fool proof as possible for the end user?
This is the current relevant part of the code:
import gspread import pandas as pd from oauth2client.service_account import ServiceAccountCredentials import PySimpleGUI as sg # define the scope scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive'] # add credentials to the account creds = ServiceAccountCredentials.from_json_keyfile_name('ABCDEFG.json', scope) # authorize the clientsheet client = gspread.authorize(creds)
Leave an answer