-1

I'm trying to create a DB from an excel spreadsheet. I can fetch data from excel and display in the html page, but I am not able to store it in sqlite db.

James Z
  • 12,209
  • 10
  • 24
  • 44
prasad-jpg
  • 21
  • 1
  • 5
  • Welcome to StackOverflow! Please take some time to review [How to ask good questions](https://stackoverflow.com/help/how-to-ask) and show code and results so far in your question. – VirtualScooter Feb 28 '21 at 15:55

2 Answers2

0

Few ways you can try:

  1. Save excel as csv. Read csv in python (link) and save in sqlite (link).
  2. Read excel into a pandas dataframe (link), and then save dataframe to sqlite (link).
  3. Read excel directly from python (link) and save data to sqlite.
S2L
  • 1,746
  • 1
  • 16
  • 20
0

I used below code which worked but it over rights file.

#import pandas software library import pandas as pd

df = pd.read_excel(r'C:\Users\kmc487\PycharmProjects\myproject\Product List.xlsx')

#Print sheet1 print(df)

df.to_excel("output.xlsx", sheet_name="Sheet_1")

Below are the input file details:

  1. My input file is in .xlsx format and file is stored as .xls(Need code to .xlsx format)
  2. File has heading in second row(First row blank)
prasad-jpg
  • 21
  • 1
  • 5