Convert CSV to Excel (.xlsx)

Hi everyone ! i want to ask somtehing. I already create automation download file csv and save it to one path. Then i want to change di format file to .xlsx
i try to convert it by scheme csv → read csv → save to data table → create new .xlsx in another path → write data table to excel
but i still failed till now to write data table. and i also already tried to print out the data table, it filled with same data in my csv. i also can create new file .xlsx in new path, but the sheet still empty, i expect that my data table will convert to excel. Or might be you guys have any tips or related step same as my case?
Thankyou

Hi @aranadya

Try using Write DataTable to Excel scticity instead of Write Range Workbook.

Regards

@aranadya

if using write range workbook activity you dont need use excel file

if using use excel file then use write datatable to excel activity

Workbook activities done need scope activity to be present

cheers

@aranadya,

Your Use Excel File activity is creating the file as it won’t be there and then inside you used Write Range workbook activity which will write the data but at end of the Use Excel File scope it automatically saves the file as blank.

As Anil pointed out, use Write Range workbook activity alone. No need to use excel process scope.

Thanks,
Ashok :slightly_smiling_face:

But i cannot find write range on my pacakges, it always shown error must be in office 365, any solution ?

Your first post has a screenshot showing “Write Range Workbook”. Use that activity outside of the Excel Process scope. Move it out and delete the Excel Process scope.

Can you show the assignment for the “excelFileName” variable?. The assignment begins with “ClientData-” + Now.To… something. It is very important that you get the correct string format here to avoid creating illegal folder/file names in Windows.

Sure, the assign
excelFileName = “ClientData-” + Now.ToString(“yyyy-MM-dd”) + “.xlsx”
destinationPathhh = "C:\Users\azzah\OneDrive\Documents\UiPath\attatchment" + excelFileName

Thank you ms, but if i create the new excel file by automate UiPath di spesific path "
destinationPathhh " which i assign before to write the data tablelike this
excelFileName = “ClientData-” + Now.ToString(“yyyy-MM-dd”) + “.xlsx”
destinationPathhh = “C:\Users\azzah\OneDrive\Documents\UiPath\attatchment” + excelFileName

is it the destination gonna be Excel.File(“destinationPathhh”) ?
thank you

Thank you for the information Mr Anil. But i want to Read Data from my CSV to Excel file, so it is possible to just use write dataTable to excel from csv ?

i also try but unfortunately it still bug

@aranadya

Destination path is a variable right…please temove inverted comma around it

Read csv should be there but use excel is jot needed when you use write range workbook

Cheers

Hello Sir, i just change my assign
destinationPathhh = “C:\Users\azzah\OneDrive\Documents\UiPath\attatchment\ClientData-” + Now.ToString(“yyyy-MM-dd”) + “.xlsx”

and write to Workbook, it works but the header not included, i already try to checklist header, but when copy to excel there’s no header. Do you have any idea ?
Thankyou

1 Like

@aranadya

Check if readcsv if header is read or not

Also check in write as well if header is checked

Both the places it is to be checked

Cheers

i already try to read it and printout, it show the header, but when it comes to excel, the header exclude

@aranadya

In write range workbook also you have add headers option please make it true or check the checkbox

Cheers

I am waiting for the another information to use write DataTable to Excel Ms. I really appreciated it

Thankyou

i already do that too sir, i think there’s might be error on my laptop, or maybe i have to restart it :" ?

@aranadya

Can you show the screenshot Of the activities once

Not restart but try to run it again and check ideally headers would be coming if you check the option and if datatable has headers

Cheers

Hallo sir, it already contain header right now

Thankyou

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.