package xlsx in power BI online

Nombre_archivo = paste("CalidadVentas", Sys.Date(), ".xlsx")
Nombre_archivo_final = gsub(" ","",Nombre_archivo)

Ruta = choose.dir(default = "", caption = "Selecione la carpeta donde guardará el archivo") ##No aparece la ventana emergente
Ruta_Normalizada = normalizePath(c(Ruta), winslash = '/')
Ruta_final = gsub(" $","",Ruta_Normalizada, perl=T)
ExportFile_pre = paste(Ruta_final, "/",Nombre_archivo_final)
ExportFile = gsub(" /","/",ExportFile_pre , perl=T)
ExportSheet   = "Consolidado"
AppendToPreviousFile  = FALSE
WithHeader    = TRUE  
DaysBetweenExports    = 0   

    options("openxlsx.dateFormat" = "mm/dd/yyyy")
    options("openxlsx.datetimeFormat" = "yyyy-mm-dd hh:mm:ss")
    excel = createWorkbook(ExportFile)                          # Create workbook (i.e. file) to put data in
    addWorksheet(excel, ExportSheet)                            # Add worksheets to workbook
    #addWorksheet(excel, ExportSheet2)
    writeData(excel, sheet = 1, dataset, , withFilter= TRUE)    # Add data to workbook
    saveWorkbook(excel, file = ExportFile, overwrite = !AppendToPreviousFile)    # Finally write out to file

Hi Eduardo, welcome!

Could you please explain what are you trying to show us with the code you have posted? What is your problem or question about this?

When I run the code in Power BI Desktop it works, a pop-up window appears asking to choose a folder to export my Excel file, but when I publish in the Power BI website, it does not work. It appears that the directory does not work.

This seems to be specific to power BI, maybe you would have better luck asking this on the power BI community forum

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