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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.