0

I have converted pdf tables data into CSV in my Django projects using Camelot and it automatically stores in my root directory. now how I'm gonna put my CSV data into my MySQL database? I have created my Model as the CSV file row's name. can anyone help to give ideas?

'''
def tables_extract(file_name):
    filename_with_path = '/pdfs/{}'.format(file_name)
    basename = os.path.basename(filename_with_path)
    basename_without_ex = os.path.splitext(basename)[0]



    tables = camelot.read_pdf(filename_with_path, pages="1-end")
    table= tables[2].df
    csv = table.to_csv("{}.csv".format(basename_without_ex))

    return csv
'''
mkl
  • 90,588
  • 15
  • 125
  • 265
zenvar
  • 19
  • 8
  • As your data already is extracted to csv, you should remove the [tag:pdf] tag and replace it by a [tag:csv] tag. – mkl Apr 28 '20 at 15:46
  • how can I return my csv to another function? I mean return the csv path to another function to iterate the csv rows and columns? – zenvar Apr 28 '20 at 18:11

0 Answers0