Based on my understanding, I think you want to upload the data of csv
file into Azure Table Storage. According to the doc of pythoncsv
package & the offical tutorial for Azure Storage Python SDK, I made the sample code & csv data as below.
For example, the data of my testing csv file as below.
Name,Species,Score
Kermit,Frog,10
Ms. Piggy,Pig,50
Fozzy,Bear,23
And the sample code.
import csv
from azure.storage.table import TableService, Entity
table_service = TableService(account_name='myaccount', account_key='mykey')
table_service.create_table('csvtable')
csvfile = open('test.csv', 'r')
fieldnames = ('Name','Species','Score')
reader = csv.DictReader(csvfile)
rows = [row for row in reader]
for row in rows:
index = rows.index(row)
row['PartitionKey'] = '1'
row['RowKey'] = '%08d' % index
table_service.insert_entity('csvtable', row)
Hope it helps.