Importing files from Google Sheets into Magento
From XTENTO Support Wiki
Using one of our import extensions for Magento 1 / 2 and want to import a sheet (containing information such as stock levels, pricing or tracking data) from Google Sheets into Magento automatically? It couldn't be easier!
First of all, you will need to open Google Sheets and get the "link" to your sheet. To do so:
- Open your Google sheet
- Click the "Share" button and select "Anyone with the link can view"
- Now we will need the sheet key. To do so, look at the URL in your browser.
- It's the bold part in this sample link: docs.google.com/spreadsheets/d/1Efy56I-tOte6P21335VNuKPuX_mh65CKpNk4UDbXk/edit#gid=0
- Copy that part (everything after d/ and before /edit) to your clipboard
- The URL to download your sheet as a CSV file now is: https://docs.google.com/spreadsheets/d/{KEY}/gviz/tq?tqx=out:csv
- Based on our sample sheet, the link would be as following: https://docs.google.com/spreadsheets/d/1Efy56I-tOte6P21335VNuKPuX_mh65CKpNk4UDbXk/gviz/tq?tqx=out:csv
- Copy the final link. This is the link to download your sheet as a CSV file, and that can easily be imported using our extension.
Now let's set up the import into Magento. Let's take our Stock Import extension as an example, the same principle applies for all our import extensions.
- Go to Catalog > Stock Import > Import Sources
- Create a new "HTTP URL Download" import source
- In the "URL" field, simply paste the link (ending in out:csv) you determined above (see here on how to get a specific sheet)
- Save the import source
That's it! You can now associate this import source to one of your import profiles, and whenever the import profile runs, it will fetch the file from Dropbox. Set up the import profile as a "CSV" import profile, as Google Sheets will return your sheet as a CSV file.