How to edit Charts in Google Spreadsheet with Google SpreadSheet API in VB - vb.net

I have a spreadsheet on my Google Account and I have some code which edits cells in this spreadsheet. Now I'm looking for a way to edit and(/or) make a new Chart in the worksheet I'm working on. I'm using the Google Spreadsheet API to edit the cells.
I did some hours of research on this topic but I just can't find how it would work. My understanding is that it is impossible with this API to work with charts. Is this correct?
I also found something about a Visualization api, but I can't figure out how to get this to work in vb, let alone how to make sure the chart I create would end up in my spreadsheet.
I want to use this chart on my own website, and I don't want to have to run the code before the graph updates. In other words, when I change the information in the cells manually via my spreadsheet I want these numbers to end up in my chart. I only want to change the chart via my code when I need to add a row or column to the chart.
Lastly, I've also read it is not possible at all to edit charts in a spreadsheet via a program. If so, I'd like to say to Google: WHY NOT!! AARGH. And maybe someone can suggest an other way to automatically update a chart which I can place on my website. (Again I want a live representation of the spreadsheet and the code I'm creating will only be run once a day if at all).
Thanks you so much for your time!

Google have Script inside the Spreadsheets that can do that for you.
https://developers.google.com/apps-script/reference/charts/

Related

Excel VBA Chart Generation using Predetermined Templates

I am new to VBA coding, and I have to automate the creation of different charts of 10+ tables of data. The chart design has to be completely the same as it was when it was done manually.
While I did try to use record macros to create the exact type of chart I need for each table, it doesn't generate the same results. Tweaking the code also takes ages for each chart individually.
While saving the wanted chart types as templates does do the trick for only one user, is it possible to somehow save them as templates in the workbook that is being used, so that the code doesn't break when it is sent to other colleagues to update the charts by adding new data?

Is it possible to extract the format options of an Excel chart into VBA code?

I am writing a macro that will automatically create a chart based off some data in a table. However, the chart format that I need to use is very complicated (20 columns of data all displayed in a particular custom format), and I don't know how to recreate that format with the chart editor, let alone VBA.
Basically, I want to be able to take an example of this chart format, and somehow get the VBA code that one would use to create a chart of this format directly in VBA, so I can include this code in the macro.
I was considering making a chart template .crtx file and including it with the spreadsheet in a .zip when the user downloads it, but templates seem to only work when they are located under User\AppData\Roaming\Microsoft\Templates\Charts, and I don't want to put the user through having to manually move this file for the macro to work. Alternatively, if anybody knows how to get a template to work when it isn't installed in this location that would be great as well!
Thanks in advance.
Include the chart with the original format in the workbook when you send it, and put the example chart on a sheet that is very hidden.
Then, write your macro such that it creates a chart of the same type with the new data and copies the formatting of the original chart.
How to make a sheet "very hidden": https://www.excel-university.com/make-an-excel-worksheet-very-hidden/
How to copy chart formatting: https://www.officetooltips.com/excel_2016/tips/a_quick_way_to_duplicate_all_of_the_custom_chart_formatting.html
Note: If you're struggling with how to use vba to copy the chart formatting, record a macro while executing the instructions at the second link.

Google Sheet to PDF MailTo: Part 2

First-timer here trying to modify code to fit my needs without any coding training. I borrowed the following google sheet to pdf mailto script from another poster (Kelvin Chong).
I am able to successfully send an email to myself with an attached PDF, but the PDF is blank. I'm apparently missing something when it comes to the script retrieving the active spreadsheet. The Google Sheet I am trying to send as a PDF is only a single sheet and I have tried both the SpreadsheetApp.openByUrl() and SpreadsheetApp.getActiveSpreadsheet() options. Neither method gives me an error when I run the script and, like I said, it emails me a PDF...it's just blank. Oh, and yes, when running the openByUrl I did enter the URL of the spreadsheet and have checked to make sure it is open for anyone to view.
Any help would be greatly appreciated. Thanks in advance!
Nevermind...I figured it out through some trial and error. Basically, the original programmer wrote the script so that it would send a zip file. Another programmer modified the script so that it would only send an individual sheet. When I started tinkering, I noticed that the zip file would have a blank page and then the actual pdf. Once I realized this, I just tinkered a little with the code to only focus on that second sheet. All is well now!

Word VBA to refresh embedded Excel chart

I have embedded charts in a Word doc. When I update the data in Excel, so that the chart in the Excel workbook updates, and then go to the Word doc, I can manually select the embedded chart, select Design > Refresh Data, and the embedded chart in Word updates to show the new data.
When I try to record the Word VBA to do that, it won't let me do those actions.
I've looked everywhere I can think of in Word's object browser. I see that I can identify the embedded chart like this:
thisdocument.InlineShapes(1)
But I don't see how to refresh it. What do I need to do?
I found the answer here:
http://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-msoffice_custom/what-is-the-vba-equivalent-of-refresh-data-for/b8405aca-716a-e011-8dfc-68b599b31bf5
thisdocument.InlineShapes(1).LinkFormat.Update
It worked fine in my tests.
And to break the link (in the word template) after updating, to avoid inadvertently updating the chart to one from a later run showing different data:
thisdocument.InlineShapes(1).LinkFormat.BreakLink

How do I use Excel to insert blocks into AutoCAD drawings?

I'm trying to use Excel to create AutoCAD drawings. I have a list of product numbers and I'd like to use VBA so that upon hitting a button it will find a block or a drawing file of every product on the list and paste them into an AutoCAD drawing (to a specific point would be a bonus).
So far I've found code that will read from two columns in Excel and will plot a polyline in ACAD using those columns as coordinates. It's very simple but not exactly what I want. Does anyone have suggestions or example code that does something similar? I've found some online using the "ThisDrawing." object but Excel isn't recognizing that so I've reached a stand still. I have all day tomorrow to work on it, so I'll be doing a lot more searching, but any help is definitely appreciated. Thank you
Autodesk provide free downloads on their website so that you can add the VBA IDE into AutoCAD.
Then, inside the AutoCAD IDE you start a new VBA project.
Add a reference to your Excel library so that you can read the Excel spreadsheet.
You need to look up on:
ThisDrawing.ModelSpace.InsertBlock
In the AutoCAD VBA manual. It tells you what various parameters. But they are straightforward - origin, scale, rotation, path to block.
When you call the InsertBlock routine it will create a AcadBlockReference object. You can do any further customization on that object.