Hey all, I am having trouble getting this code to run.

Hey all, I am having trouble getting this code to run. I am trying to go into my S3 bucket and convert my .xlsx file to .csv so i can easily upload it to redshift. My code currently looks like the below, does anyone know an easy way to convert files in s3?

data_xls = pd.read_excel('s3://syznyctest/file_path/file_name.xlsx',
'sheet name', index_col=None)
data_xls.to_csv('s3://syznyctest/new_file_path/new_file_name.csv', encoding='utf8',index=False)
You already invited:

Alzico

Upvotes from:

 just a hunch but you might need to wrap the file opening in some s3 library (boto3?) that reads files. I can't remember off hand what that is. i.e. boto3.open('filename', 'r') or whatever it is.

Bobby

Upvotes from:

I don't think that s3 is the issue. On Linux, we read from s3 all the time. Why don't you try to read a simple CSV file from s3 and see if s3 is the issue, or something else

If you wanna answer this question please Login or Register