Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Lebunim
Regular Visitor

Export to excel or csv using R script with Specific format

Hi all,

I have created a report and I need to export certain part after analysis aplied. I created an R Script which run each time I refresh the data. I'm pretty happy with the end result, but I would like to improve format of the export. 

 

In my export I get Sequence (not needed), UserName (Needed), Date (bad format).

 

Script: 

# dataset <- data.frame(UserPrincipalName, Latest Usage, License Type, License Owner)
# dataset <- unique(dataset)

# Paste or type your script code here:
library(utils)
write.csv (dataset, file ="D:/Licenses/TelecomUserLicenseUsage.csv");
 
Can someone help me modify script to remove sequence column which is added automatically by R Script and change the date to this format - YYYY-MM-DD
 
Many thanks in adavance

 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Please try:

1. Convert all date columns to "Whole Number." 

2. Run the R scriptChange the datatype back to date once the script has provided an output.

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Please try:

1. Convert all date columns to "Whole Number." 

2. Run the R scriptChange the datatype back to date once the script has provided an output.

mahoneypat
Microsoft Employee
Microsoft Employee

Have you considered using a Paginateed Report to export your data?  Or the new Power Automate visual, so you get just the fields you want, and then create file, email it or store on SharePoint, etc.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.