Конвертер данных: Google Sheets в SQL, SQL в Google Sheets

Вы можете построить конвертер данных, преобразующий данные CSV или Google Sheet в SQL. Также это также инструктирует вас, как вернуть им данные SQL.

Loading…

Loading…

Loading…

Loading…

Loading…

Connect() – Creating a Connection to an SQLite Database

The sqlite3 connect() the function returns a Connection object that we will use to interact with the SQLite database held in the file. For example, here we create a new DB file name in b2bcontacts.DB

connection = sqlite3.connect("ceInfluencer.db")

Cursor() and Execute() – Create a new data table in the DB file

The sqlite3. Cursor class is an instance using which you can invoke methods that execute SQLite statements, fetch data from the result sets of the queries. You can create a Cursor object using the cursor() method of the Connection object and class.

cursor = connection.cursor()

Loading…

cursor.execute('''CREATE TABLE prospect(Category TEXT, Quality_Score TEXT, Country TEXT, B2BLead_Name TEXT, Email Contact TEXT)''')

Loading…

Loading…

B2BData = []

with open("B2Bdata_Inventory.csv","r") as csv_file:

csv_reading = csv.reader(csv_file)

header = next(csv_reading)

if header != None:

for i in csv_reading:

column1 = i[0:]

B2BData.append(column1)

df = pd.DataFrame(influencerData)

Loading…

for item in range(len(df)):

cursor.execute('''INSERT INTO influencer VALUES(?,?,?,?,?)''', df.iloc[item])

Loading…

Commit () and Close ()

Loading…

Loading…

Loading…

Loading…

  • scope = ['https://www.googleapis.com/auth/spreadsheets','https://www.googleapis.com/auth/drive.file','https://www.googleapis.com/auth/drive']
  • creds = ServiceAccountCredentials.from_json_keyfile_name('theGoogleServiceAccountJsonFile.json', scope)
  • client = gspread.authorize(creds)
  • sh = client.open('theSheetName')
  • worksheet = sh.get_worksheet(theTabNumber)
  • vLookupValue = worksheet.get_values(theDataRange')
  • df = pd.DataFrame(vLookupValue)

Loading…

Loading…

connection = sqlite3.connect('googleCompetitor.db')

googleData = []

data = connection.cursor()

for column in data.execute('SELECT * FROM influencer'):

    googleData.append(column)

df = pd.DataFrame(googleData)

print(df)

df.to_csv('competitorTesting.csv', encoding='utf-8-sig')

Loading…

Loading…

df = pd.DataFrame(googleData)

value_list = sh.values_update("testing!A1", params={'valueInputOption': 'USER_ENTERED'},body=dict(values=df.T.reset_index().T.values.tolist()))

Loading…

If you are interested in the full Python script of Chapter 46: Data Converters to convert CSV to SQL, SQL to CSV, Google Sheets to SQL, please subscribe to our newsletter by adding the message “Chapter 46”. We would send you the script immediately to your mailbox.

Loading…

  • Support and donate to our channel through PayPal (paypal.me/Easy2digital)
  • Subscribe to my channel and turn on the notification bell Easy2Digital Youtube channel.
  • Follow and like my page Easy2Digital Facebook page
  • Loading…
  • Buy products with Easy2Digital 10% OFF Discount code (Easy2DigitalNewBuyers2021)
  • Вы регистрируетесь на нашем еженедельном информационном бюллетене, чтобы получить последние 2 -дигитальные последние статьи, видео и скидки
  • Subscribe to our monthly membership through Patreon to enjoy exclusive benefits (www.patreon.com/louisludigital)

ЧАСТО ЗАДАВАЕМЫЕ ВОПРОСЫ:

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…