'How to update a Existing Excel in the S3 using a Glue Job?

I am trying to query some data from redshift and update those details to existing excel in the s3 bucket. So far when I tried via visual no xls options were available. I want to do it via pyspark / spark. I was able to load a CSV and save to a CSV. but could not load an excel and update to it

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job

## @params: [JOB_NAME]
args = getResolvedOptions(sys.argv, ['JOB_NAME'])

sc = SparkContext()
glueContext = GlueContext(sc)
spark = glueContext.spark_session
df=spark.read.csv('s3://folder/adds1.csv')
df.write.format('csv').save('s3://folder/output/')
job = Job(glueContext)
job.init(args['JOB_NAME'], args)
job.commit()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source