Skip to content

Instantly share code, notes, and snippets.

View DataSolveProblems's full-sized avatar
💭
Github Working In Progress

Jie Jenn DataSolveProblems

💭
Github Working In Progress
View GitHub Profile
import sys
from PyQt5.QtWidgets import QWidget, QDesktopWidget, QApplication
class Demo(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Center the app')
import os, io
import re
from google.cloud import vision
from google.cloud import storage
from google.protobuf import json_format
"""
# pip install --upgrade google-cloud-storage
"""
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
import os, io
from google.cloud import vision
from google.cloud.vision import types
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
client = vision.ImageAnnotatorClient()
FOLDER_PATH = r'<Folder Path>'
IMAGE_FILE = '<image file name>'
from googleapiclient.discovery import build
import pandas as pd
API_SERVICE_NAME = 'discovery'
API_VERSION = 'v1'
service = build(API_SERVICE_NAME, API_VERSION)
api_service = service.apis()
df_list = pd.DataFrame(api_service.list().execute().get('items'))
print(df_list)
import pickle
import os
from google_auth_oauthlib.flow import Flow, InstalledAppFlow
from googleapiclient.discovery import build
from google.auth.transport.requests import Request
def Create_Service(client_secret_file, api_service_name, api_version, *scopes):
SCOPES = [scope for scope in scopes[0]]
print(SCOPES)
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame({
'a': np.random.randint(0, 5, size=5),
'b': np.random.randint(0, 5, size=5),
'c': np.random.randint(0, 5, size=5)
})
import os, io
from google.cloud import vision
from google.cloud.vision import types
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
client = vision.ImageAnnotatorClient()
import win32com.client as win32
from Google import Create_Service
CLIENT_SECRET_FILE = 'client_secret.json'
API_SERVICE_NAME = 'sheets'
API_VERSION = 'v4'
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
gsheet_id = '<Google Sheets Id>'
gsheet_name = 'sheet1'
Sub SearchEmails()
Dim olNS As NameSpace
Dim FolderInbox As MAPIFolder
Dim filtered_items As Items
Dim olMail As MailItem
Dim strFilter As String
Set olNS = GetNamespace("MAPI")
Set FolderInbox = olNS.GetDefaultFolder(olFolderInbox)
from Google import Create_Service
import win32com.client as win32
xlApp = win32.Dispatch('Excel.Application')
wb = xlApp.Workbooks.Open(r"<Excel File Path>")
ws = wb.Worksheets('<Worksheet Name>')
rngData = ws.Range('A1').CurrentRegion()
# Google Sheet Id
gsheet_id = '<Google Sheet Id>'