Power BI Desktop - How to change data source? - powerbi

When I'm trying to change my existing data source (Microsoft Azure CosmosDB) to Blob Storage, the Change source is disabled. How do I workaround this?
I have gone through various questions but none of them were similar to mine.
Any help is much appreciated.
Thanks

Workaround
Click on edit queries
Select the query
Advanced Editor
You can change the datasource from here.
Then do apply , export if necessary

Like #rinjan stated above go to the advanced editor on your table in the query editor. Then you will get something like this (This is an Excel connection):
let
Source = Folder.Files("J:\TestPath"),
#"J:\TestPath\Map1 xlsx" = Source{[#"Folder Path"="J:\TestPath\",Name="Map1.xlsx"]}[Content],
#"Imported Excel" = Excel.Workbook(#"J:\TestPath\Map1 xlsx"),
Map1_Sheet = #"Imported Excel"{[Item="Map1",Kind="Sheet"]}[Data],
....and so on
Best way to go here is to copy paste the whole text into the text editor and chose the option replace all with the following line (for this example):
Old value: J:\TestPath
New value: J:\New\Path
If it is not working you have to inspect the lines of codes. Maybe you find the missing piece.

The first line of every table must be Source:
https://community.powerbi.com/t5/Community-Blog/Why-can-t-I-change-the-Data-Source-in-Power-BI-disabled-button/ba-p/915365

Related

Text wrapping in .docx output of flextable in r-markdown

I have a r-markdown doc that has a flextable that spreads over multiple pages and on my own computer it knits to docx. perfectly. However, now it is on the server and it automated the knitted document has the table on a new page. This can be manually changed in the outputted word doc by changing "text wrapping" to "Around" in "table Properties" menu. This is workable but as these docs are automated, I would like the format to be correct from the begininng. Any ideas on how to force the table to stay on the first page with the headings??
** I should add that saving the table properties in the reference doc does not seem to help.
Cheers
Silas
I asked the author of the flextable package a similar question. He suggested I change the knitr chunk option ft.keepnext to FALSE and it worked for me.
```{r, ft.keepnext = FALSE}
myflextable
```

add macro to excel using python xlswriter with data in original excel

I'm using the following code to add a Macro to Excel. I notice that the data / other WorkSheets from the original Excel had dropped completely but the Macro is showing.
This is the code that I am using:
import xlsxwriter
workbooks = xlsxwriter.Workbook('C:\\Users\\user\Desktop\\test.xlsm')
workbooks.add_vba_project('C:\\Users\\user\\Desktop\\vbaProject.bin')
workbooks.close()
I used the link http://xlsxwriter.readthedocs.io/example_macros.html and it seems to be the same from another page https://redoakstrategic.com/pythonexcelmacro/
I wondered if there is another library that I should use for this?
I tried the following link Use Python to Inject Macros into Spreadsheets it seems that here again the data from the original file is overwritten. Not sure if this is a duplicate or not, or if I missed something rather obvious ?
Thanks
Unfortunately, xlsxwriter can't load information from already existing Excel workbooks; it is only used for making new ones. You are overwriting your old workbook with a blank one that has your macros.
If you need to load information, look into openpyxl. It can be used for creating .xlsm files.
One way around it is to create the macro you want in another Excel so we can execute it to affect the other Excel. Then using win32.com it runs the VBA.
enter code here
#import win32com.client
#xl=win32com.client.Dispatch("Excel.Application")
#xl.Workbooks.Open(Filename="C:\\macro.xlsm",ReadOnly=1)
#xl.Application.Run("macro")
#xl = 0

Workbook gem - how to write the excel to html in a formatted manner?

I am using Workbook gem to preview the excel file without page breaks in my website. Right now, I am successful in extracting the excel file and writing it into html format and display as preview.
The following code extracts and writes the excel to html:
excel_file = Workbook::Book.open "#{file_url}"
excel_file.write_to_html(file_name + ".html")
But this gives me an unformatted html sheet with no rows and columns or any of the existing excel file.
According to murb/workbook documentation, it is said that we can pass the format as a hash within its options.
write_to_html(filename = "#{title}.html", options = {})
So, to achieve the format hash, I tried the following code:
excel_file.template.formats
But this returns a null hash. So, how can i get all the formats from the excel file and write to html? Or at least show the html table with borders for all rows and columns.
The author here. The Workbook gem is mainly built to extract and rerepresent the data in files, and not so much the formatting. In the past I made a few attempts on adding support to maintain formatting when converting, but it is far from complete. Some importers don't even set the formatting hash as you found out, notably the xlsx importer needs work on this.
The HTML was built to simply give a basic preview of the data. It basically returns a html-page with all tables which is by default unformatted, although format-names are used in the classes. There is an option though, if you'd pass style_with_inline_css: true... but then it requires an importer to actually set the format hash properly...
I'm happy to guide you here and there when you want to improve the xlsx importer code to suit your needs and hopefully the workbook gem in general, but it will need serious work if you want more than just some background colours and font properties.

How to disable DOI/URL for bibtex in Rmarkdown

I am using better bibtex and zotero to generate references in rmarkdown.
It works very good except that journal articles and books have an url/doi associated.
My adviser is not too happy about it and I could not figure out how to disable the url/doi in the rmarkdown config or elsewhere.
What I know is that you have to edit your *.csl file (asa.csl, apa.csl or something you use). You could accomplish this very easy by uploading it to this online csl editor. Browse to bibliography/layout/access(macro)/Group/conditional/ and look if there is an URL entry. I got rid of the DOI by setting an option there that the variable should be 'url' AND the document type 'webpage'. Then download the new *csl file, save it to your prefered directory and just knit it. (Look also here with pictures).
Note: Please make rather a safety copy before messing around with your *csl.

Visual Studio resource editor: there can only be one string table?

I created a string table in my .rc file containing my English strings - now I need to add another string table for a different language.
If I try to do:
Add Resource... -> String Table -> New
I get the error: "there cannot be more than one instance of this type".
I know I can open up the .rc file in notepad and add language in there but how am I suppose to do this from inside Visual Studio?
Yes, it is very well hidden. Double-click the .rc file in Solution Explorer to open the Resource View window. Expand the String Table node, right-click "String Table" and select "Insert Copy". That takes you to the language selection combo.
As nobugz mentioned, you can only have one string table per language.
But back to the bigger picture: is is considered a bad practice to store several languages in one executable/dll. The "best current practice" is to have resource-only dlls, one per language. Then you have full control on what language is loaded (otherwise you let Windows do the decision for you).
Take also a look at the MUI API
(http://msdn.microsoft.com/en-us/goglobal/bb978454.aspx, especially the "Getting started" section on the left)
In the end, there can be only one. (sorry, I couldn't resist).
It will let you add a table if it isn't the same language as the current table,
Try changing the language on your current string table to something else "Basque" maybe, then add the new table, then change it back.
Create a new resource file and add new string table with the same language.
I hope it will work ...I tried it..!!!