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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is 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.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors