Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,128 members, 7,811,185 topics. Date: Sunday, 28 April 2024 at 05:35 AM

Import This Googlemap Route Data Into Googlesheet - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Import This Googlemap Route Data Into Googlesheet (398 Views)

I need help to get Instagram video views count Into A Googlesheet / Import Route Data Drawn On Google Map Into A Googlesheet. / Import Big Data Into Mysql Using Simple Trick (2) (3) (4)

(1) (Reply) (Go Down)

Import This Googlemap Route Data Into Googlesheet by Zhirinovsky: 5:42pm On Mar 13, 2023
Please I need somone who can write a function or script that can import the route data in the Google map below to googlesheet please.

I will pay for the service.

Google maps location with custom data https://www.google.com/maps/d/edit?mid=1fOVCWQow9MHSqVY1g7qPEQRPfKPEq5iT&usp=sharing

1 Like

Re: Import This Googlemap Route Data Into Googlesheet by truthCoder: 6:43pm On Mar 13, 2023
Zhirinovsky:
Please I need somone who can write a function or script that can import the route data in the Google map below to googlesheet please.

I will pay for the service.

Google maps location with custom data https://www.google.com/maps/d/edit?mid=1fOVCWQow9MHSqVY1g7qPEQRPfKPEq5iT&usp=sharing


1. Create a new Google Sheet and get its ID.
2. Enable the Google Sheets API and the Google Maps JavaScript API in the Google Cloud Console.
3. Use the Google Maps JavaScript API to access the route data from the My Maps link you provided. You can use the google.maps.KmlLayer class to load the KML file of the My Maps data, and then parse the data to extract the route information.
4. Use the Google Sheets API to insert the route data into the Google Sheet.





// Replace YOUR_SPREADSHEET_ID with the ID of your Google Sheet.
const SPREADSHEET_ID = 'YOUR_SPREADSHEET_ID';

// Load the Google Sheets API client library.
gapi.load('client', () => {
gapi.client.init({
apiKey: 'YOUR_API_KEY',
discoveryDocs: ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
}).then(() => {
// Use the Google Maps JavaScript API to load the My Maps KML data.
const kmlUrl = 'https://www.google.com/maps/d/kml?mid=1fOVCWQow9MHSqVY1g7qPEQRPfKPEq5iT';
const kmlLayer = new google.maps.KmlLayer({
url: kmlUrl,
suppressInfoWindows: true,
});
kmlLayer.addListener('metadata_changed', () => {
// Parse the KML data to extract the route information.
const metadata = kmlLayer.getMetadata();
const routeData = metadata.document.placemark
.filter(placemark => placemark.LineString)
.map(placemark => placemark.LineString.coordinates)
.join('\n');

// Use the Google Sheets API to insert the route data into the Google Sheet.
const range = 'A1';
const values = [[routeData]];
const body = { values };
gapi.client.sheets.spreadsheets.values.update({
spreadsheetId: SPREADSHEET_ID,
range,
valueInputOption: 'USER_ENTERED',
resource: body,
}).then(() => {
console.log('Route data inserted successfully.');
}, (error) => {
console.error(`Error inserting route data: ${error}`);
});
});
}, (error) => {
console.error(`Error initializing API client: ${error}`);
});
});

Re: Import This Googlemap Route Data Into Googlesheet by Zhirinovsky: 4:20am On Mar 14, 2023
@truthCoder Thank you so much Bro. You are God sent.

I will run the program on the google script editor and get back to you please.
Re: Import This Googlemap Route Data Into Googlesheet by Zhirinovsky: 4:25am On Mar 14, 2023
Hello truthCoder,

I ran the program and got this error; gapi is not defined

Can you help please

Re: Import This Googlemap Route Data Into Googlesheet by truthCoder2: 4:56am On Mar 14, 2023
Zhirinovsky:
@truthCoder Thank you so much Bro. You are God sent.

I will run the program on the google script editor and get back to you please.

my main account was banned just now wile providing the response.

send me an email on truthcoder@protonmail.com
Re: Import This Googlemap Route Data Into Googlesheet by Zhirinovsky: 10:31am On Mar 14, 2023
Thank you.

Please did you receive my last mail?
truthCoder2:


my main account was banned just now wile providing the response.

send me an email on truthcoder@protonmail.com

(1) (Reply)

Promising And Good Looking Web Forum For Sale (call Now If Interested) / Looking For A New Way To Learn New Things / Get Best Sitecore Training By Industry Experts At Cheap Price

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.