Does anyone know of an existing app script that can be used to import all data in an excel worksheet over to a google sheet?
I have an excel file that is automatically updated daily from a database with all the data I need for my reports. The problem is that I'm required to use Google Sheets.
I'm currently having to manually copy all the data from the "Database Dump" worksheet in my excel file and paste the data to my google sheet "Excel Import" tab every day.
My reports are located in other tabs of the Google Sheet and pull their data from the "Excel Import" tab in the same google sheet.
I would rather have an app script that kicks off whenever I open the google sheet and automates the manual function above. Any ideas from you brilliant Google Sheet users?
Manual Process
EVERY FIVE MIN DATABASE AUTO UPDATES EXCEL FILE: WORKSHEET - "Database Dump" >>>>>> Manually Copied Each Day to...>>>>>>>>>> GOOGLE SHEET: TAB - "Excel Import"
Proposed Automated Process
DATABASE AUTO UPDATES EXCEL FILE: WORKSHEET - "Database Dump" >>>>>> Auto Updated Upon Google Sheet Open >>>>>>>>>> GOOGLE SHEET: TAB - "Excel Import"
Here's one way to do it:
Install Google Drive on your PC - you'll use it to sync a file to somewhere a Google Apps Script can access it. (Can't access your PC directly.)
Use a VBA script in your Excel spreadsheet that runs daily to generate a CSV of the data you're interested in. Same script (or a separate batch file, as a scheduled task) should copy the csv to your Google Drive.
Use a time-based trigger function in your Google Spreadsheet to import the CSV file, which has synced to Google Drive.
Set the timing for the various events, scheduled tasks and triggers so that you have a reliable cascade, and you're set.
Related
I am having difficulty finding a way to modify an online SharePoint file using excel VBA. The goal of the project is to create a live dashboard of all our company's trackers, which pulls in all the data from the trackers and consolidates them into one place for review, with the important feature that if a task is marked complete on the dashboard, the corresponding data on the original tracker is marked as complete as well. However, from what I've run into so far the SharePoint file size limit isn't enough for all the data I'm trying to pull in to just run this all from there. Therefore I'm making the dashboard in an offline format. This is where I'm running into my issue. I can open the files from SP via VBA and copy in the data but they are read-only and I haven't found a way to edit them without saving them as a new file and overwriting the old one Sharepoint. This solution isn't feasible as the SharePoint files are constantly being updated and this could overwrite data that wasn't there when I downloaded it. Looking for a way to update a SharePoint file dynamically and in real time from the offline file using VBA if this action is even possible.
"I can open the files from SP via VBA and copy in the data but they are read-only" - you can definitely open a Sharepoint file read-write in Excel as long as you have the required privileges. Maybe you're using the wrong-format link?
The Sharepoint "Copy Link" doesn't typically give you what you'd need for this - see example below:
Dim wb As Workbook
'Direct from "copy Link" - doesn't work
Set wb = Workbooks.Open("https://company.sharepoint.com/:x:/r/sites/DeptName/TestLibrary/Tester.xlsx?d=w6e00e447050d4e68b363c8a9311a5a99&csf=1&web=1&e=luXOna")
'works with some edits
Set wb = Workbooks.Open("https://company.sharepoint.com/sites/DeptName/TestLibrary/Tester.xlsx")
wb.Sheets(1).Range("a3").Value = "Test"
wb.Close True 'save changes
See this thread for what those various "flags" in the URL are for:
https://techcommunity.microsoft.com/t5/sharepoint/what-is-f-r-in-shared-urls/m-p/234117
I have an online data source that I've linked to excel using the domo excel extension. This enables me to download data tables straight from domo into a an excel doc. My goal is to use a macro to automate the following steps:
At a 12am ET on Sunday morning, open an new excel document
Access the extension and download a data table
Save the newly populated excel table as "Data File (date)" into a specific folder.
In my limited experience with VBA, i attempted to record even just the download process from an open sheet and excel stops recording as soon as I click on the extension tab.
two-part question: First, is there a way to access the extension via my macro? If so, is it possible to schedule the desired process?
Thank you!
Can Excel retrieve data from a Google Spreadsheet? When I open Excel file.. some fields in it need information from a Google Excel spreadsheet.
Thanks!
Yes, it's possible to do this in a basic way without doing any programming:
Ensure your Google Spreadsheet has been "Published to Web"
In Excel, go to the Data tab and choose to create a new web query "From Web" − paste the link that would have been copied to your clipboard when you published Google's sheet
Your Google sheet will now appear inside Excel.
First set the google sheet to "anyone with link can edit". Then download the google sheet as .xlsx. Copy the url of the download, paste it in Excel's get data from Web module. Tada!
I am trying to import data into an Excel spreadsheet from a published Google sheet. I have published the Google sheet and copied the URL.
When I try and use that URL in my Excel spreadsheet, either with VB code or by standard Data Get External data From Web it asks me to log-in to Google. How can I get the data without having to log-in.
You can select in Google Sheets to publish as a CSV file
Then in excel use Data -> import FROM TEXT (not from web)
Paste in the link to the google sheets csv file
This should read and recognise the file, you will need to configure headers, and the Comma as the separator, format etc
Then finally one it has been imported if you go to Data -> connections you can change refresh times etc
If you are willing to use an add-in, you can have Excel and Google Sheets stay in synch.
Data Everywhere makes add-ins for Google Sheets and Excel that allows you to sync data between Google Sheets and Excel. You just highlight the data you want to synchronize, and both your Excel spreadsheets and your Google Sheets spreadsheets will always be in sync.
You can get it at Data Everywhere, or from the Google Sheets Add-in store at https://chrome.google.com/webstore/detail/data-everywhere/foenaaepondggfpfonagpmdaggmpdeel?hl=en-US
Unfortunately, this add-on no longer works.
I have a few Excel files (Pivot Tables & Charts) that have a data connection to an Access database. What I'm hoping to do is have them automatically refresh and get emailed on the 1st of each month.
I do something similar in Access, where I have a database with a query that gets run and emailed. I accomplished this by creating a form in the database, having the form open automatically when the database is opened, and then used VBA within the form to run the query (DoCmd.OpenQuery) and then email it (DoCmd.SendObject)
Can I do something similar with an Excel file? I'm thinking I could set the Connection Properties under the Data tab to "Refresh data when opening the file", but that assumes the user has an active network connection as the database is on a server. Also, if the user saves the file and opens it again in the future, it will have current data and not the original data.
So in a nutshell I need to:
Open Excel File
Refresh Data
Email File
Here's what I ended up doing:
In Access, I have some Make Table queries that make tables (duh) which will be used by the Excel files. I created a form, have it open automatically when the database opens, and in the Form_Load() event I put the following:
With DoCmd
.SetWarnings False
.OpenQuery "My Query 1"
.OpenQuery "My Query 2"
.SetWarnings True
End With
Application.Quit
In each Excel file, I found some VBA code online to create a PDF and then email it. In the Workbook_Open() event, I have the following:
ActiveSheet.Unprotect
ActiveWorkbook.Connections("MyConnection").Refresh
ActiveSheet.Protect
Call FunctionThatCreatesPDFAndEmails
ActiveWorkbook.Close False
I then put some tasks in Windows Task Scheduler .. one to open the Access database (which causes the Make Table queries to run and then closes itself) and then one task for each Excel file that I need to update and email. So now I have Access updating the source data tables, and then Excel opening each file, refreshing the data, and emailing a PDF of itself. Mission Accomplished!