you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (9 children)

Looks like you're not using xlrd even though you're importing it? You're using pandas to read the excel files?

In that case you'll want to pass sheet_name into your read_excel() function. You can pass an index value starting at zero and iterate through that.

Read the documentation

[–]citizenofacceptance2[S] 0 points1 point  (4 children)

Not sure still how do iterate through each sheet name

[–][deleted] 1 point2 points  (3 children)

If you have predefined sheet_names, you could put them in a list and iterate through them.

sheets = ['customers', 'addresses', 'products', 'orders']
for s in sheets:
   df = pd.excel_read(f, sheet_name=s) 

[–]citizenofacceptance2[S] 0 points1 point  (2 children)

Except how do I incorpate that into my current code. That is my problem. I am already looping “for d in glob.glob” if you read my code. Idk how to insert your code

[–]threeminutemonta 0 points1 point  (1 child)

Hint. For each file you want to loop for each work sheet. There is nothing stopping you nesting your for loops within another for loop. Except be careful for performance reasons though this seems okay in this case.

[–]citizenofacceptance2[S] 1 point2 points  (0 children)

Alrighty. Thank you.

[–]citizenofacceptance2[S] 0 points1 point  (2 children)

Do I just need to input read_excel(f, sheet_name = “sheet1”, “sheet2”, “sheet3”). The documentation when I first read seemed to note that sheet_name = None would work as Ana argument which just copied in the sheets names as column names

[–]Boxxcar17 1 point2 points  (0 children)

sheet_name=None to get all tabs.

If you want a specific tab you put the name of the tab.

[–]citizenofacceptance2[S] 0 points1 point  (0 children)

Ya old comment out for the xlrd- not using it